So, this is the South Florida curse. You can not find a PHP programmer. I don’t know what’s the problem (it is more like a curse over the state), but it’s really hard to find a programmer in South Florida. We have been looking for some one almost since my last programmer (not a good one B.T.W) left the company, that is October 2007. Since there, we started the hiring process, and right now we are willing to take whoever shows up at the door.
But one of the important lessons I’d learned is that there is not such a thing as PHP skills test. So basically we had to come up we our own Test. When we started the process, the PHPST (PHP Skills Test) was harder. I used to try the candidates in arrays, math functions, string management, and so, and so. But rapidly I realized that this test just shows me, how much time do you spend in php.net. Not your potential. So I came up with this new test, which is more close to the real life.
In the day-to-day work, you have to pick some one else code, you have to modify established programs. You must be able to read code as you read English (or Spanish in my case). So I hope you enjoy this PHPST.
-
<?
-
/**
-
* Beasley Interactive PHP5 programming skills test.
-
*
-
* 1) You need to complete the following code. The code is just a form that's gonna be sending someinformation to the database and sending some emails. Complete the functions.
-
* and complete the logic.
-
*/
-
$html='';
-
if(isset($_POST['submit']) && trim($_POST['submit'])){
-
-
$post_html=saveForm($_POST);
-
-
$managers_emails=array('webmaster@bbgi.com','oswaldo@bbgi.com','you@bbgi.com');
-
$user_email=(isset($_POST['sendme_an_email']) && $_POST['sendme_an_email']=='true')?$_POST['sendme_an_email']:array(); //???? Would you be able to explain this logic
-
$email_array=array_merge($managers_emails,????); //What should be merge here. ????
-
if(sendEmail($post_html,$email_array)){
-
$html.='Thanks for submitting this form';
-
}
-
else{
-
$html.='an Error…..';
-
}
-
-
}else{
-
$html.='<form name="contactForm" method="POST" action="'.$_SERVER['PHP_SELF'].'">';
-
-
$html.='Name: <input type"text" name="name">';
-
$html.='Last Name: <input type"text" name="lastname">';
-
$html.='Email: <input type"text" name="email">';
-
$html.='Phone Number: <input type"text" name="phone">';
-
$html.='Comments: <textarea name="comments"></textarea>';
-
$html.='Send me and Email: <input type="checkbox" name="sendme_an_email" value="true">';
-
$html.='<input type="submit" value="Send">';
-
-
-
$html.='</form>';
-
-
-
}
-
-
function saveForm($post){
-
-
$post_html='';
-
//Here the logic to save and create the $post_html Complete this part
-
//1) Create a DB Connection
-
//2) Select which ever table you want to select.
-
//3) Create the $html to save in the DB.
-
//4) Save the data in a table.
-
//5) return the html
-
-
-
-
-
-
return $post_html;
-
}
-
-
function sendEmail($html,$email_array){
-
//Send an email to every single email in this email array.
-
-
-
}
-
-
?>
-
-
<?=$html?>
