Skip to content

Instantly share code, notes, and snippets.

@kozo002
Created October 30, 2012 15:57
$fruits = array('banana', 'melon', 'orange');
function joinFruits($fruits) {
$result = '';
foreach ($fruits as $fruit) {
$result .= $fruit;
}
return $result;
}
$fruits_str = joinFruits($fruits);
var_dump($fruit); // => undefined variable error
var_dump($fruits_str); // => bananamelonorange
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment