當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ArrayObject::asort方法代碼示例

本文整理匯總了PHP中ArrayObject::asort方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArrayObject::asort方法的具體用法?PHP ArrayObject::asort怎麽用?PHP ArrayObject::asort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ArrayObject的用法示例。


在下文中一共展示了ArrayObject::asort方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

 function it_proxies_method_calls_to_wrapped_object(\ArrayObject $obj, WrappedObject $wrappedObject)
 {
     $obj->asort()->shouldBeCalled();
     $wrappedObject->isInstantiated()->willReturn(true);
     $wrappedObject->getInstance()->willReturn($obj);
     $this->call('asort');
 }
開發者ID:burimshala,項目名稱:numbertowords,代碼行數:7,代碼來源:CallerSpec.php

示例2:

 function it_proxies_method_calls_to_wrapped_object(\ArrayObject $obj, WrappedObject $wrappedObject, AccessInspectorInterface $accessInspector)
 {
     $obj->asort()->shouldBeCalled();
     $wrappedObject->isInstantiated()->willReturn(true);
     $wrappedObject->getInstance()->willReturn($obj);
     $accessInspector->isMethodCallable(Argument::type('ArrayObject'), 'asort')->willReturn(true);
     $this->call('asort');
 }
開發者ID:EnmanuelCode,項目名稱:backend-laravel,代碼行數:8,代碼來源:CallerSpec.php

示例3: getArrayProfilSorted

 /**
  * get an array sorted by value.
  */
 public function getArrayProfilSorted()
 {
     $resArraySorted = new ArrayObject($this->getArrayProfil());
     $resArraySorted->asort();
     return $resArraySorted;
 }
開發者ID:Biobanques,項目名稱:cbsd_platform,代碼行數:9,代碼來源:User.php

示例4: array

<?php

$array = array('IMG0.png', 'img12.png', 'img10.png', 'img2.png', 'img1.png', 'IMG3.png');
$arr1 = new ArrayObject($array);
$arr2 = clone $arr1;
$arr1->asort();
echo "Standard sorting\n";
print_r($arr1);
$arr2->natcasesort();
echo "\nNatural order sorting (case-insensitive)\n";
print_r($arr2);
開發者ID:badlamer,項目名稱:hhvm,代碼行數:11,代碼來源:natcasesort.php

示例5: microtime

$memory = memory_get_usage(1);
$time = microtime(1);
for ($i = 0; $i < 1000; $i++) {
    $plist->insert("zero#{$i}", -$i);
}
printf("\nnset plist: time: %f, memory: %d KB\n", microtime(1) - $time, round((memory_get_usage(1) - $memory) / 1000, 2));
$memory = memory_get_usage(1);
$time = microtime(1);
for ($i = 0; $i < 1000; $i++) {
    $top = $slist->first();
}
printf("\ntop slist: time: %f, memory: %d KB\n", microtime(1) - $time, round((memory_get_usage(1) - $memory) / 1000, 2));
$memory = memory_get_usage(1);
$time = microtime(1);
for ($i = 0; $i < 1000; $i++) {
    $alist->asort();
    $top = key($alist);
}
printf("\ntop alist: time: %f, memory: %d KB\n", microtime(1) - $time, round((memory_get_usage(1) - $memory) / 1000, 2));
$memory = memory_get_usage(1);
$time = microtime(1);
for ($i = 0; $i < 1000; $i++) {
    $top = $plist->top();
}
printf("\ntop plist: time: %f, memory: %d KB\n", microtime(1) - $time, round((memory_get_usage(1) - $memory) / 1000, 2));
$memory = memory_get_usage(1);
$time = microtime(1);
for ($i = 0; $i < 1000; $i++) {
    $item = $slist->get($i);
}
printf("\nget slist: time: %f, memory: %d KB\n", microtime(1) - $time, round((memory_get_usage(1) - $memory) / 1000, 2));
開發者ID:php-ion,項目名稱:php-ion,代碼行數:31,代碼來源:skiplist.php

示例6: ArrayObject

<?php

// SPL stands for Standard PHP Library
$fruits = ["dollar" => 10, "sterlin" => 5, "euro" => 25];
$obj = new ArrayObject($fruits);
foreach ($obj as $key => $value) {
    echo "{$key} ... {$value}" . PHP_EOL;
}
$obj->asort();
foreach ($obj as $key => $value) {
    echo "{$key} ... {$value}" . PHP_EOL;
}
$obj->ksort();
foreach ($obj as $key => $value) {
    echo "{$key} ... {$value}" . PHP_EOL;
}
/*
Flag Effect

ArrayObject::STD_PROP_LIST  Properties of the object have their normal functionality when accessed as list (var_dump, foreach, etc.).
ArrayObject::ARRAY_AS_PROPS Entries can be accessed as properties (read and write).
*/
var_dump($obj->dollar);
$obj->setFlags(ArrayObject::ARRAY_AS_PROPS);
var_dump($obj->dollar);
foreach ($obj as $key => $value) {
    echo "{$key} => {$value}" . PHP_EOL;
}
開發者ID:wilk,項目名稱:zend-php-certification,代碼行數:28,代碼來源:spl.php

示例7: ArrayObject

<?php

/* Prototype  : int ArrayObject::asort()
 * Description: proto int ArrayIterator::asort()
 * Sort the entries by values. 
 * Source code: ext/spl/spl_array.c
 * Alias to functions: 
 */
echo "*** Testing ArrayObject::asort() : basic functionality ***\n";
$ao1 = new ArrayObject(array(4, 2, 3));
$ao2 = new ArrayObject(array('a' => 4, 'b' => 2, 'c' => 3));
var_dump($ao1->asort());
var_dump($ao1);
var_dump($ao2->asort('blah'));
var_dump($ao2);
var_dump($ao2->asort(SORT_NUMERIC));
var_dump($ao2);
?>
===DONE===
開發者ID:badlamer,項目名稱:hhvm,代碼行數:19,代碼來源:arrayObject_asort_basic1.php

示例8: array

<?php

$fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple");
$fruitArrayObject = new ArrayObject($fruits);
$fruitArrayObject->asort();
foreach ($fruitArrayObject as $key => $val) {
    echo "{$key} = {$val}\n";
}
開發者ID:badlamer,項目名稱:hhvm,代碼行數:8,代碼來源:asort.php

示例9: C

<?php

/* Prototype  : int ArrayObject::asort()
 * Description: proto int ArrayIterator::asort()
 * Sort the entries by values. 
 * Source code: ext/spl/spl_array.c
 * Alias to functions: 
 */
echo "*** Testing ArrayObject::asort() : basic functionality ***\n";
class C
{
    public $prop1 = 'x';
    public $prop2 = 'z';
    private $prop3 = 'a';
    public $prop4 = 'x';
}
$c = new C();
$ao1 = new ArrayObject($c);
var_dump($ao1->asort());
var_dump($ao1, $c);
?>
===DONE===
開發者ID:badlamer,項目名稱:hhvm,代碼行數:22,代碼來源:arrayObject_asort_basic2.php

示例10: asort

 public function asort()
 {
     $this->lazyLoadArray();
     parent::asort();
 }
開發者ID:jinshana,項目名稱:kajonacms,代碼行數:5,代碼來源:class_orm_assignment_array.php

示例11: asort

 /**
  * Implementation of ArrayObject::asort().
  *
  * Sorts the entries such that the keys maintain their correlation with the
  * entries they are associated with. This is used mainly when sorting
  * associative arrays where the actual element order is significant.
  *
  * No value is returned.
  */
 public function asort()
 {
     $this->arrayObject->asort();
 }
開發者ID:pbull,項目名稱:acquia-platform-cloud-data-model,代碼行數:13,代碼來源:ArrayObjectImplementationMethods.php


注:本文中的ArrayObject::asort方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。