Select chapter



Basics (2.papers)

Sponsored Links


  

php interview questions and answers

1
What output will give the following statement.
 <?php
  echo "This is a "simple statement" in PHP.";
 ?>
  1. This is a "simple statement" in PHP.
  2. This is a simple statement in PHP.
  3. Syntax error.
  4. none of the above
Show Answer
Share Facebook gmail Twitter
2
What output will give the following statement.
 <?php 
  echo "This is a 'simple statement' in PHP.";
 ?>
  1. This is a 'simple statement' in PHP.
    
  2. This is a simple statement in PHP.
    
  3. Syntax error.
    
  4.  none of the above
Show Answer
Share Facebook gmail Twitter
3
What output will give the following statement.
 <?php 
  echo "This is a simple statement in php \\"
 ?>
  1. This is a simple statement in PHP \\.
  2. This is a simple statement in PHP \.
  3. Syntax error.
  4. none of the above
Show Answer
Share Facebook gmail Twitter
4
 What is the difference between $_POST and $_GET variables.
  1. $_POST and $_GET variables are different from other simple variables, this variables can hold more variable values.
     The major difference is the value passing type.
     
     $_GET will send the values through the URL { Ex: http://www.example.com/index.php/?a=10&b=20&c=30 }
      From the URL we will get the values as follows 
      $var1 = $_GET['a'];
      $var2 = $_GET['b'];
      $var3 = $_GET['c'];
      
     $_POST will not send the values through the URL
     In the submitted page we have to get the values as follows:
      $var1 = $_POST['a'];
      $var2 = $_POST['b'];
      $var3 = $_POST['c'];
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
7
<?php $str1 = 'hellow';
 $str2 = 'hEllow';
 strcmp($str1, $str2);
 ?>
  1.  0 (both are equal)
  2. 1 (not equal)
  3. 0(not equal)
  4. 1(equal)
Show Answer
Share Facebook gmail Twitter
8
Write a form that can allow file upload.
  1. <form action="upload_file.php" method="post" enctype="multipart/form-data">
        Filename:<input type="file" name="file" id="file"><br>
        <input type="submit" name="submit" value="Submit">
       </form>
     {Here, in that action may be any php file path, method should either GET or POST, 
      enctype="multipart/form-data" this is mandatory, with out that file upload in form is not possible and input type should be file}
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
10
What is the output of below PHP program?
<?php 
   $country = 'india';
   $$country = 'banglore';
   echo $country.' , '.$india
  ?>
  1.  banglore , india
  2. india , banglore
  3. Undefined variable $india in line no 4
  4. Syntax error, semicolon missing in line no 4
Show Answer
Share Facebook gmail Twitter
11
What is PHP?
  1. PHP is a server side scripting language. It is an object oriented language. You can use it to create dynamic web pages.
    PHP is freeware (free to use) unlike ASP (Microsoft product)
    
Show Answer
Share Facebook gmail Twitter
12
What is the full form of PHP?
  1. PHP: Hypertext Preprocessor
Show Answer
Share Facebook gmail Twitter
13
What you can do with PHP?
  1. • you can collect form data
    • you can create dynamic web pages (page content)
    • you can send and receive cookies
    • you can control the data in the database
    • you can also create desktop applications by using php.
    
Show Answer
Share Facebook gmail Twitter
14
What are the operations systems supported for php?
  1. Almost all o.s’s support php. Like windows, macintosh, linux, unix, solaris, RISC OS etc..
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
17
What does a PHP file can contain?
  1. It can contain HTML, CSS, Simple text, Java Script, and PHP code. (Generally a php file will contain HTML tags, and php script code)
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
19
How does a php script code will look like?
  1. Php script will start with <?php   and ends with ?>
      It looks like <?php   
                                Code;
                              ?>
    
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Read more papers :