Over a million developers have joined DZone.

How fast can you spot PHP Bugs?

DZone's Guide to

How fast can you spot PHP Bugs?

· Web Dev Zone ·
Free Resource

Learn how to add document editing and viewing to your web app on .Net (C#), Node.JS, Java, PHP, Ruby, etc.

Blake over at PHP vs .NET has written up a very nice article to prepare those who are interviewing for a php job soon. He basically gives a bunch of php snippets and asks where the bugs are. The article somewhat morphs into a mish-mash of good-practice/bad-practice comparison and explains why one way is better than the other.

From the article:

Find the errors in the following code:

function baz($y $z) {
    $x = new Array();
    $x[sales]  = 60;
    $x[profit] = 20:

    foreach($x as $key = $value) {
        echo $key+" \"+$value+\"<BR>\";


Extend your web service functionality with docx, xlsx and pptx editing. Check out ONLYOFFICE document editors for integration.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}