Created
November 6, 2015 19:38
-
-
Save sakadon/9b6abc21e243c9ca026a to your computer and use it in GitHub Desktop.
オブジェクトに対して、オブジェクトを後ろに追加したい ref: http://qiita.com/sakadon/items/548703904bfe70df5d06
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//$objects = 10個ぐらいで、 | |
//$objects->name = 'unko' は3個としよう | |
$push = new ArrayObject(); | |
foreach( $objects as $object ){ | |
if( $object->name == 'unko' ){ | |
$push->append( $object ); | |
} | |
} | |
count($push); // -> 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment