本文整理汇总了PHP中ArrayList::getByFunctionVale方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayList::getByFunctionVale方法的具体用法?PHP ArrayList::getByFunctionVale怎么用?PHP ArrayList::getByFunctionVale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayList
的用法示例。
在下文中一共展示了ArrayList::getByFunctionVale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TestClass
//This is the object we want to find in the list.
$list->add($x);
$x = new TestClass(1);
$list->add($x);
$x = new TestClass(69);
$list->add($x);
$x = new TestClass(420);
$list->add($x);
$x = new TestClass(1337);
$list->add($x);
//Now try and find the object with the value we want
$object = $list->getByFunctionVale('getData', 90);
echo 'Found Object ' . $object->getData();
//Prints 90
//Using Strict Comparison (For Object based searching)
//Create the list
$list = new ArrayList('TestClass');
$sub_objectA = new TestClass('Whatever Sub Object A');
$sub_objectB = new TestClass('Whatever Sub Object B');
$sub_objectC = new TestClass('Whatever Sub Object C');
//Create our Objects
$x = new TestClass($sub_objectA);
$list->add($x);
$x = new TestClass($sub_objectB);
//We want to find this.
$list->add($x);
$x = new TestClass($sub_objectC);
$list->add($x);
$object = $list->getByFunctionVale('getData', $sub_objectB);
echo 'Found Object ' . $object->getData()->getData();
//Prints "Whatever Sub Object B"