本文整理匯總了PHP中CMbArray::ksortByProp方法的典型用法代碼示例。如果您正苦於以下問題:PHP CMbArray::ksortByProp方法的具體用法?PHP CMbArray::ksortByProp怎麽用?PHP CMbArray::ksortByProp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CMbArray
的用法示例。
在下文中一共展示了CMbArray::ksortByProp方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testKsortByProp
public function testKsortByProp()
{
$obj1 = new stdClass();
$obj1->foo = "bar1";
$obj2 = new stdClass();
$obj2->foo = "bar2";
$objects = array($obj2, $obj1);
$this->assertTrue($this->stub->ksortByProp($objects, "foo"));
$this->assertEquals(array($obj1, $obj2), $objects);
$obj1 = new stdClass();
$obj1->foo = "bar";
$obj1->baz = "bar1";
$obj2 = new stdClass();
$obj2->foo = "bar";
$obj2->baz = "bar2";
$objects = array($obj2, $obj1);
$this->assertTrue($this->stub->ksortByProp($objects, "foo", "baz"));
$this->assertEquals(array($obj1, $obj2), $objects);
}
示例2: loadExtCodesCCAM
/**
* Charge les codes CCAM en tant qu'objets externes
*
* @return void
*/
function loadExtCodesCCAM()
{
$this->_ext_codes_ccam = array();
$this->_ext_codes_ccam_princ = array();
$dateActe = CMbDT::format($this->_datetime, "%Y-%m-%d");
if ($this->_codes_ccam !== null) {
foreach ($this->_codes_ccam as $code) {
$code = CDatedCodeCCAM::get($code, $dateActe);
/* On supprime l'activité 1 du code si celui fait partie de la liste */
if (in_array($code->code, self::$hidden_activity_1)) {
unset($code->activites[1]);
}
$this->_ext_codes_ccam[] = $code;
if ($code->type != 2) {
$this->_ext_codes_ccam_princ[] = $code;
}
}
CMbArray::ksortByProp($this->_ext_codes_ccam, "type", "_sorted_tarif");
}
}