1. Question:What is constant? How can you declare a constant? 

    Answer
    A constant is a value that cannot be modified throughout the execution of a program. Constant are declare by using the define() function.Its prototype follows:
    
    boolean define(string name, mixed value)Example
    define("PI",3.14159);
    echo PI; //returns 3.14159

    1. Report
  2. Question:Which functions are used to add file in a script?

     

    Answer
    PHP offers four function for including files into applications. These are:

    include(), require(), include_once(), require_once().

    1. Report
  3. Question:How to create an PHP array of a group of items inside an HTML form? 

    Answer
    We can create input fields with same name for "name" attribute with squire bracket at the end of the name of the name attribute, It passes data as an array to PHP super global. 
    For instance :
    
    <input name="MyArray[]" />  
    <input name="MyArray[]" />  
    <input name="MyArray[]" />

    1. Report
  4. Question:What are passing arguments by reference and passing arguments by value? 

    Answer
    By reference: When we pass an argument by reference, we pass a pointer to the value in memory. The function operates on the argument. When a function changes the value of an argument passed by reference,the original value changes.By value: When we pass an argument by value, we pass a copy of the value in memory. The function operates on the copy. This means that when a function changes the value of an argument passed by value, the effect is local to that function; the copy changes but the original value in memory is not affected.

    1. Report
  5. Question:What are the types of key of array?

     

    Answer
    Each array consists of two components:  key and a value. Keys can be numerical or associative. Numerical key use numeric value and associative key use string value.


    1. Report
  6. Question:Between echo () and print () functions which one is the faster and why?

     

    Answer
    The echo() function is a tad faster than print() function; because it returns nothing, whereas print () will return 1 if the statement is successfully output. 


    1. Report
  7. Question:What is the importance of "action" attribute in a html form? 

    Answer
    The action attribute determines where to send the form-data in the form submission.

    1. Report
  8. Question:What is the use of header() function in php? 

    Answer
    The header() function sends a raw HTTP header to a client browser.Remember that this function must be called before sending the actual out put.For example, You do not print any HTML element before using this function.
    It is most frequently used to redirect request to get other file. example: 
    The following code can be used for it, 
    header("Location:index.php");

    1. Report
  9. Question:Which functions are used to add file in a script? 

    Answer
    Ans: There are four functions are used to add file in a script . Such as:
    ♦ include() function
    ♦ include_once() function
    ♦ require () function
    ♦ require_once() function

    1. Report
  10. Question:How to run the interactive PHP shell from the command line interface? 

    Answer
    Just use the PHP CLI program with the option -a as follows:
    php -a

    1. Report
Copyright © 2024. Powered by Intellect Software Ltd