Created
May 24, 2011 16:10
-
-
Save davidwood/989019 to your computer and use it in GitHub Desktop.
Single line access to array value
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
<?php | |
function returnArray() { | |
return array('item1', 'item2', 'item3'); | |
} | |
function array_value(&$arr, $index) { | |
return $arr[$index]; | |
} | |
echo array_value(returnArray(), 1); | |
?> |
getify
commented
May 24, 2011
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment