Skip to content

Instantly share code, notes, and snippets.

@wizardishungry
Created June 27, 2012 19:12
Show Gist options
  • Save wizardishungry/3006116 to your computer and use it in GitHub Desktop.
Save wizardishungry/3006116 to your computer and use it in GitHub Desktop.
explanation of how list() doesn't work with key based arrays in php
<?php
$picture = new Imagick($path);
print_r($picture->getImageGeometry());
list($width, $height) = $picture->getImageGeometry(); // doesn't work
list($width, $height) = array_values($picture->getImageGeometry()); // works
Array
(
[width] => 800
[height] => 742
)
Undefined offset: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment