nikifi
-
Posts
2 -
Joined
-
Last visited
Posts posted by nikifi
-
-
Hello there, first of all I want to say I am a big fan of Larry Ullman's book. I used it to learn introductory PHP and now I am back learning advanced PHP. I am in chapter one working through the task list example. I have come across the following code:
while (list($task_id, $parent_id, $task) = mysqli_fetch_array ($r, MYSQLI_NUM)) { echo "<option value=\"$task_id\">$task</option>\n"; $tasks[] = array('task_id' => $task_id, 'parent_id' => $parent_id, 'task' => $task); }
My question is - I thought I read somewhere that it is a bad practice to set a variable in a conditional statement, as in the case here where it is setting a list of variables to the values of an array. Is there any basis to this statement?
Chapter 1
in PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
Posted
Hello there, thanks for the response. I doubt it was even referring to PHP. I don't have a reference, it's just one of those things I remember reading somewhere and it remained in my head. I don't even know if it is from a reputable source, but I figure I'd post the question here and see your point of view.