当前位置: 首页>>代码示例>>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;未经允许,请勿转载。