本文整理匯總了PHP中ArrayObject::natcasesort方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArrayObject::natcasesort方法的具體用法?PHP ArrayObject::natcasesort怎麽用?PHP ArrayObject::natcasesort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ArrayObject
的用法示例。
在下文中一共展示了ArrayObject::natcasesort方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
<?php
$array = array('koala', 'kangaroo', 'wombat', 'wallaby', 'emu', 'kiwi', 'kookaburra', 'platypus');
/*** create the array object ***/
$arrayObj = new ArrayObject($array);
/*append a new value in the array*/
$arrayObj->append('dingo');
/*Sort a arrayobject */
$arrayObj->natcasesort();
/*Get the iterator obj*/
$iterator = $arrayObj->getIterator();
$arrayObj->offsetUnset(5);
if ($arrayObj->offsetExists(4)) {
echo "Offset exitst" . "<br>";
}
/*Count the total array*/
echo "Total amount of " . $arrayObj->count() . "<br>";
/*Get traverse the whole the array*/
while ($iterator->valid()) {
echo $iterator->key() . ' => ' . $iterator->current() . '<br />';
$iterator->next();
}
示例2: array
<?php
//重點是演示ArrayObject中的natcasesort()方法
$array = array('koala', 'kangaroo', 'wombat', 'wallaby', 'emu', 'kiwi', 'kookaburra', 'platypeus');
$array_obj = new ArrayObject($array);
$array_obj->natcasesort();
for ($iterator = $array_obj->getIterator(); $iterator->valid(); $iterator->next()) {
echo $iterator->key(), "=>", $iterator->current(), "\n";
}
示例3: natcasesort
public function natcasesort()
{
$this->lazyLoadArray();
parent::natcasesort();
}
示例4: ArrayObject
<?php
/* Prototype : int ArrayObject::natcasesort()
* Description: proto int ArrayIterator::natcasesort()
Sort the entries by values using case insensitive "natural order" algorithm.
* Source code: ext/spl/spl_array.c
* Alias to functions:
*/
echo "*** Testing ArrayObject::natcasesort() : 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->natcasesort());
var_dump($ao1);
var_dump($ao2->natcasesort('blah'));
var_dump($ao2);
?>
===DONE===
示例5: natcasesort
/**
* Implementation of ArrayObject::natcasesort().
*
* This method is a case insensitive version 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".
*
* No value is returned.
*/
public function natcasesort()
{
$this->arrayObject->natcasesort();
}