splitbrain.org

electronic brain surgery since 2001

What is wrong in this Code?

We have a web developer position1) to fill at CosmoCode and my task is to check possible candidates for their web skills. What I came up with, and what seems to work quite well, is a simple test. I show the candidate the following code and ask them to point out errors.

My rationale is this: any half decent PHP programmer will come up with quite a few obvious errors. But the better candidates will not only find those obvious flaws but will also point out non fatal errors and bad style. Those are the ones we're looking for. Unfortunately the market is very bad currently.

Anyway, give the code a try. What mistakes can you spot? Let me know in the comments :-).

<html>
<head>

<style>
  body {
    font: "Times New Roman";
  }
</style>

</head>
<body>

<?
    $roles[andi]   = "Developer";
    $roles[detlef] = "Boss";
?>

<img src="logo.gif" align=left>

<H1>Hello <?= $roles[$_GET['user']]?>!</H1>

<?
    $list = new Array();
    $list[] = "Apple";
    $list[] = "Peach":
    $list[] = "Orange";

    for(i=0; i<count($list); i++){
      echo "<li><b><i>".$list[$i]."</b></i>";
    }
?>

</body>
</html>




To really test your self, try to find the errors before looking at the comments ;-)


Tags:
php, webdevel, assessment, job, test
Similar posts:
1)
Check the job description if you're interested