1. Question:What is the most convenient hashing method to be used to hash passwords? 

    Answer
    It is preferable to use crypt() which natively supports several hashing algorithms or the function hash() which supports more variants than crypt() rather than using the common hashing algorithms such as md5, sha1 or sha256 because they are conceived to be fast. hence, hashing passwords with these algorithms can vulnerability.

    1. Report
  2. Question:What is the difference between ereg_replace() and eregi_replace()?

     

    Answer
    ereg_replace: The ereg_replace() function operates to finding and replacing a pattern with a replacement string.

    eregi_replace : The eregi_replace() function operates exactly like ereg_replace(), except that the search for pattern in
    string is not case sensitive.


    1. Report
  3. Question:What is the static variable in function useful for? 

    Answer
    A static variable is defined within a function only the first time and its value can be modified during function calls as follows:
    <?php 
    function testFunction() { 
     static $testVariable = 1;
     echo $testVariable; 
     $testVariable++; 
    } 
    testFunction();        //1 
    testFunction();        //2 
    testFunction();        //3 
    ?>

    1. Report
  4. Question:Which cryptographic extension provide generation and verification of digital signatures? 

    Answer
    The PHP-openssl extension provides several cryptographic operations including generation and verification of digital signatures.

    1. Report
  5. Question:What are the different functions in sorting an array? Discuss them?

     

    Answer
    array_reverse():    reverses an array’s element order.

    array_flip(): reverses the roles of the keys and their corresponding values.
        
    sort(): sorts an array, ordering elements from lowest to highest value.

    rsort(): sorts array items in reverse (descending) order.

    asort() : sorting an array in ascending order, except that the key/value correspondence is maintained.

    arsort(): it sorts the array in reverse order maintained key/value co-relation.


    1. Report
  6. Question:What should we do to be able to export data into an Excel file? 

    Answer
    The most common and used way is to get data into a format supported by Excel. For example, it is possible to write a .csv file, to choose for example comma as separator between fields and then to open the file with Excel.

    1. Report
  7. Question:How do you execute a PHP script from the command line? 

    Answer
    Just use the PHP command line interface (CLI) and specify the file name of the script to be executed as follows:
    php script.php

    1. Report
  8. 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
  9. Question:What is object cloning? 

    Answer

    To remedy the problems with copying, PHP offers an explicit means for cloning an object is known as object cloning.


    1. Report
  10. Question:Which programming language does PHP resemble to? 

    Answer
    PHP syntax resembles Perl and C

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