Skip to content

Instantly share code, notes, and snippets.

@jpic
Created April 2, 2010 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpic/353199 to your computer and use it in GitHub Desktop.
Save jpic/353199 to your computer and use it in GitHub Desktop.
<?php
$fixture = new ArrayObject( array(
'a',
'b',
'c',
) );
unset( $fixture[1] );
$fixture = new ArrayObject(
array_values($fixture)
);
var_dump( $fixture );
# Warning: array_values(): The argument should be an array in /tmp/test.php on line 12
#
# Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Passed variable is not an array or object, using empty array instead' in /tmp/test.php:13
# Stack trace:
# #0 /tmp/test.php(13): ArrayObject->__construct(NULL)
# #1 {main}
# thrown in /tmp/test.php on line 13
#
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment