PHP Logical & Programming Interview questions

  1. Write a program in Php to check whether a number is prime or not?
  2. Write a program to find no of days between two dates in Php?
  3. Write a program in PHP to find the occurrence of a word in a string?
  4. Write a program to upload a file in PHP?
  5. Write a program to find a string is palindrome or not?
  6. Write a program to find the factorial of a number in PHP?
  7. Php Code to find whether a number Armstrong or not?
  8. Php Program to generate Fibonacci series?
  9. Write a program in PHP to print a table of a number?
  10. Write a program in PHP to reverse a number?
  11.  Write a PHP function to convert all null values to blank?
PHP Logical & Programming

Here is the list of top 10 PHP Programs Asked to write you in your next PHP Interviews for 1 year Php Experience or PHP Fresher.

Download PHP Logical & Programming PDF

When we are outputting our results into JSON for purpose of web services then It is a good practice to convert all null value to an empty string, below is simple PHP function to convert all null values to blank.


function convertNullToBlank($array){

foreach ($array as $key => $value) {
if (is_null($value)) {
$array[$key] = "";
}
}
return $array;

}

Above function takes an array as an argument and converts it all null values to blank.