4 ms·
Before there were iterators in PHP `while ($row = fetch_row())` was the only sensible iteration pattern. Before there were exceptions `if ($result = query())`
by johannes1234321 8y ago
Before there were iterators in PHP `while ($row = fetch_row())` was the only sensible iteration pattern.
Before there were exceptions `if ($result = query())` was the cleanest error-checking approach.
Also PHP didn't invent that syntax in any way, but followed C (in the end early PHP was a simplified C created by a C programmer) it only later git higher level constructs making this less needed.