Skip to content

Instantly share code, notes, and snippets.

@sakadon
Created November 6, 2015 19:38
Show Gist options
  • Save sakadon/9b6abc21e243c9ca026a to your computer and use it in GitHub Desktop.
Save sakadon/9b6abc21e243c9ca026a to your computer and use it in GitHub Desktop.
オブジェクトに対して、オブジェクトを後ろに追加したい ref: http://qiita.com/sakadon/items/548703904bfe70df5d06
//$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