Sr. PHP Programmer Question:
Download Questions PDF

The value of the variable input is a string 1,2,3,4,5,6,7. How would you get the sum of the integers contained inside input?

Answer:

<?php
echo array_sum(explode(',',$input));
?>

The explode function is one of the most used functions in PHP, so it's important to know if the developer knows this function. There is no unique answer to this question, but the answer must be similar to this one.

Download Senior PHP Programmer Interview Questions And Answers PDF

Previous QuestionNext Question
How can we get the IP address of the client?What is MIME?