当前位置: 首页>>代码示例>>PHP>>正文


PHP ArrayObject::natsort方法代码示例

本文整理汇总了PHP中ArrayObject::natsort方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayObject::natsort方法的具体用法?PHP ArrayObject::natsort怎么用?PHP ArrayObject::natsort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArrayObject的用法示例。


在下文中一共展示了ArrayObject::natsort方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: natsort

 public function natsort()
 {
     parent::natsort();
     return $this;
 }
开发者ID:smagic39,项目名称:PHP-String-Class,代码行数:5,代码来源:Array.php

示例2: sprintf

<?php

$data = array('mela', 'pera', 'bananaa', 'arancia');
$object = new ArrayObject($data);
echo sprintf('L\'array contiene %d elementi', $object->count()), PHP_EOL;
$object->natsort();
echo 'Elemento con indice 0: ', $object[0], PHP_EOL;
foreach ($object as $value) {
    echo $value, PHP_EOL;
}
class Persona
{
    public $nome;
    public $cognome;
    public $telefono;
}
$persona = new Persona();
$persona->cognome = 'Rossi';
$persona->nome = 'Mario';
$persona->telefono = '223344';
$obj_array = new ArrayObject($persona);
echo sprintf('L\'oggetto persona contiene %d elementi', $obj_array->count()), PHP_EOL;
$obj_array->natsort();
foreach ($obj_array->getIterator() as $name => $value) {
    echo $name . ': ' . $value, PHP_EOL;
}
开发者ID:GrUSP,项目名称:php_best_practices,代码行数:26,代码来源:array_object.php

示例3: ArrayObject

<?php

/* Prototype  : int ArrayObject::natsort()
 * Description: proto int ArrayIterator::natsort()
 Sort the entries by values using "natural order" algorithm. 
 * Source code: ext/spl/spl_array.c
 * Alias to functions: 
 */
echo "*** Testing ArrayObject::natsort() : basic functionality ***\n";
$ao1 = new ArrayObject(array('boo10', 'boo1', 'boo2', 'boo22', 'BOO5'));
$ao2 = new ArrayObject(array('a' => 'boo10', 'b' => 'boo1', 'c' => 'boo2', 'd' => 'boo22', 'e' => 'BOO5'));
var_dump($ao1->natsort());
var_dump($ao1);
var_dump($ao2->natsort('blah'));
var_dump($ao2);
?>
===DONE===
开发者ID:badlamer,项目名称:hhvm,代码行数:17,代码来源:arrayObject_natsort_basic1.php

示例4: ArrayObject

<?php

$dados = ['salmão', 'tilápia', 'sardinha', 'badejo', 'pescada', 'dourado', 'corvina', 'cavala', 'bagre'];
$objarray = new ArrayObject($dados);
$objarray->append('bacalhau');
print 'Posição 2: ' . $objarray->offsetGet(2) . '<br>' . PHP_EOL;
$objarray->offsetSet(2, 'linguado');
print 'Posição 2: ' . $objarray->offsetGet(2) . '<br>' . PHP_EOL;
$objarray->offsetUnset(4);
if ($objarray->offsetExists(10)) {
    echo 'Posição 10 encontrada' . '<br>' . PHP_EOL;
} else {
    echo 'Posição 10 não encontrada' . '<br>' . PHP_EOL;
}
print 'Total: ' . $objarray->count();
$objarray[] = 'atum';
$objarray->natsort();
print '<br>' . PHP_EOL;
foreach ($objarray as $item) {
    print 'Item: ' . $item . '<br>' . PHP_EOL;
}
print $objarray->serialize();
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:22,代码来源:spl_array.php

示例5: natsort

 public function natsort()
 {
     $this->lazyLoadArray();
     parent::natsort();
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:5,代码来源:class_orm_assignment_array.php

示例6: natsort

 /**
  * Implementation of ArrayObject::natsort().
  *
  * This method implements a sort algorithm that orders alphanumeric strings
  * in the way a human being would while maintaining key/value associations.
  * This is described as a "natural ordering". An example of the difference
  * between this algorithm and the regular computer string sorting algorithms
  * (used in ArrayObject::asort) method can be seen in the example below.
  *
  * No value is returned.
  */
 public function natsort()
 {
     $this->arrayObject->natsort();
 }
开发者ID:pbull,项目名称:acquia-platform-cloud-data-model,代码行数:15,代码来源:ArrayObjectImplementationMethods.php


注:本文中的ArrayObject::natsort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。