1. Question:Difference between array_merge() and array_slice()?  

    Answer
    Ans: The array_merge() function merges one or more arrays into one array. This function returns one array with the elements of all the parameter arrays.

    The array_slice() function returns selected parts of an array. The array_slice() function returns part of an array as specified by the start and length parameters. If start is a positive number, it means that the ”slice” will start that many elements from the beginning of the array.


    1. Report
  2. Question:Difference between array_merge() and array_slice()?  

    Answer
    Ans: The array_merge() function merges one or more arrays into one array. This function returns one array with the elements of all the parameter arrays.

    The array_slice() function returns selected parts of an array. The array_slice() function returns part of an array as specified by the start and length parameters. If start is a positive number, it means that the ”slice” will start that many elements from the beginning of the array.


    1. Report
  3. Question:What are the abstract class and interface?

     

    Answer
    Abstract class: An Abstract. Class is a class that cannot be instantiated but instead serves as a base class to be inherited by other classes.
    Interface: An Interfaces is a collection of unimplemented method definitions and constantswithout specifying exactly how it must be implemented.


    1. Report
  4. Question:Define exceptions?

     

    Answer
    An exception is an abnormal condition that arises in a code sequence at run time. Basically there are four important keywords which form the main pillars of exception handling: try, catch, throw and finally. 


    1. Report
  5. Question:What is PDO? 

    Answer
    The PDO ( PHP Data Objects ) extension defines a lightweight, consistent interface for accessing databases in PHP. if you are using the PDO API, you could switch the database server you used, from say PgSQL to MySQL, and only need to make minor changes to your PHP code.  
    
    While PDO has its advantages, such as a clean, simple, portable API but its main disadvantage is that it doesn't allow you to use all of the advanced features that are available in the latest versions of MySQL server. For example, PDO does not allow you to use MySQL's support for Multiple Statements.

    1. Report
  6. Question:What is regular expression?

     

    Answer
    Regular expressions provide the foundation for describing or matching data according to defined  syntax rules. Generelly regular expressions declared by "/^[value]{range}$/";.


    1. Report
  7. Question:What are magic methods in PHP? 

    Answer
    Magic methods are the members functions that is available to all the instance of class Magic methods always starts with "__". Eg. 
    __construct All magic methods needs to be declared as public To use magic method they should be defined within the class or program scope Various Magic Methods used in PHP 5 are: __construct() __destruct() __set() __get() __call() __toString() __sleep() __wakeup() __isset() __unset() __autoload() __clone()

    1. Report
  8. Question:How many ways you can read a file?

     

    Answer
    We can read a file using the following mode and Methods:-
    Methods- file(), file_get_contents(), fgetcsv(), fgets(), fgetss(), fgetc(),fresd(), readfile(), fscanf(). 
    Mode-  R, r+, w+, a+, x+


    1. Report
  9. Question:Why substr() is used? 

    Answer
    Ans:  The substr() function is used to return the part of a string located between a predefined starting offset and length position.
    Its prototype follows:
    string substr(string str, int start [, int length])

    1. Report
  10. Question:How many ways you can write into a file?

     

    Answer
    We can write into a file using the following mode and Methods:
    Methods- fwrite() with fopen, file_put_contants().  
    Mode-  r+,  W,  w+, A, a+, X, x+


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