Jump to content

[SOLVED] How is this While Do loop moving forward?


pandu

Recommended Posts

Hi,

 

Check out the code below. I dont understand how the while..do loop keeps looping because instead of having a condition, there is an assignment statement. Can someone explain how this loop is working? Shouldn't there be two equal symbols in those condition brackets? By the way, the function containing this code takes a table and adds $data to the $table. The code snippet below builds the query to add the data

 

while (list($columns,) = each($data)) {

  $query .= ' ' . $columns . ' , ';

}

 

TIA

It is some essence while there are still things to assign.

 

If there are no longer things to assign then it will be false.  It will loop through each one and assign them.  Once there aren't any more to assign then it will no longer work.  Make sense?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.