PHP Logical & Programming Interview questions

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.

  • Q1.

    Write a program in Php to check whether a number is prime or not?

  • Q2.

    Write a program to find no of days between two dates in Php?

  • Q3.

    Write a program in PHP to find the occurrence of a word in a string?

  • Q4.

    Write a program to upload a file in PHP?

  • Q5.

    Write a program to find a string is palindrome or not?

  • Q6.

    Write a program to find the factorial of a number in PHP?

  • Q7.

    Php Code to find whether a number Armstrong or not?

  • Q8.

    Php Program to generate Fibonacci series?

  • Q9.

    Write a program in PHP to print a table of a number?

  • Q10.

    Write a program in PHP to reverse a number?

  • Q11.

     Write a PHP function to convert all null values to blank?

    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.

Ask a Question