php - non-initialized referenced variable doesn't throw notice -


i have function takes variable reference:

function get_articles($limit = 10, &$more = false){   $results = get_results_from_db($limit);    $more = ($results->found > $limit) ? $results->found : false;   return $results->data; } 

which use like:

$articles = get_articles(10, $more_results);  foreach($articles $article){   // stuff }  if($more_results) // have more 10 results 

but don't notice telling me $more_results above undefined... normal?

yes, because $more_results defined @ least false value (after calling function).
inside function variable not defined, since doesn't read content of variable, notice not generated.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -