Skip to content

Instantly share code, notes, and snippets.

@varemenos
Created March 17, 2012 15:39
Show Gist options
  • Save varemenos/2061303 to your computer and use it in GitHub Desktop.
Save varemenos/2061303 to your computer and use it in GitHub Desktop.
PHP - List Function
<?php
$temp = array('one', 'two', 'three', 'four');
list($one, $two, $three, $four) = $temp;
var_dump($temp);
var_dump($one, $two, $three, $four);
// RESULTS
/*
array($temp)
0 => string 'one' (length=3)
1 => string 'two' (length=3)
2 => string 'three' (length=5)
3 => string 'four' (length=4)
string($one) 'one' (length=3)
string($two) 'two' (length=3)
string($three) 'three' (length=5)
string($four) 'four' (length=4)
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment