300+ TOP PHP+MySQL Interview Questions & Answers

    1. 1. Who Is The Father Of Php And Explain The Changes In Php Versions?
      Rasmus Lerdorf is known as the father of PHP. PHP/FI 2.0 is an early and no longer supported version of PHP. PHP 3 is the successor to PHP/FI 2.0 and is a lot nicer. PHP 4 is the current generation of PHP, which uses the Zend engine under the hood. PHP 5 uses Zend engine 2 which, among other things, offers many additional OOP features

 

    1. 2. How Can We Submit A Form Without A Submit Button?
      The main idea behind this is to use Java script submit() function in order to submit the form without explicitly clicking any submit button. You can attach the document.formname.submit() method to onclick, onchange events of different inputs and perform the form submission. you can even built a timer function where you can automatically submit the form after xx seconds once the loading is done (can be seen in online test sites).

PHP Interview Questions

    1. 3. In How Many Ways We Can Retrieve The Data In The Result Set Of Mysql Using Php?
      You can do it by 4 Ways

      1. mysql_fetch_row.
      2. mysql_fetch_array
      3. mysql_fetch_object
      4. mysql_fetch_assoc

 

    1. 4. What Is The Difference Between Mysql_fetch_object And Mysql_fetch_array?
      mysql_fetch_object() is similar to mysql_fetch_array(), with one difference – an object is returned, instead of an array. Indirectly, that means that you can only access the data by the field names, and not by their offsets (numbers are illegal property names).

PHP Tutorial

    1. 5. What Is The Difference Between $message And $$message?
      It is a classic example of PHP’s variable variables. take the following example.$message = “Mizan”;$$message = “is a moderator of PHPXperts.”;$message is a simple PHP variable that we are used to. But the $$message is not a very familiar face. It creates a variable name $mizan with the value “is a moderator of PHPXperts.” assigned. break it like this${$message} => $mizanSometimes it is convenient to be able to have variable variable names. That is, a variable name which can be set and used dynamically.

MySQL Interview Questions

    1. 6. How Can We Create A Database Using Php And Mysql?
      We can create MySQL database with the use of mysql_create_db(“Database Name”)

 

    1. 7. Can We Use Include (“abc.php”) Two Times In A Php Page “makeit.php”?
      Yes we can use include() more than one time in any page though it is not a very good practice.

MySQL Tutorial
Drupal Interview Questions

    1. 8. What Are The Different Tables Present In Mysql, Which Type Of Table Is Generated When We Are Creating A Table In The Following Syntax:
      Create Table Employee (eno Int(2),ename Varchar(10)) ?

      Total 5 types of tables we can create

      1. MyISAM
      2. Heap
      3. Merge
      4. INNO DB
      5. ISAM

      MyISAM is the default storage engine as of MySQL 3.23 and as a result if we do not specify the table name explicitly it will be assigned to the default engine.

 

    1. 9. Functions In Imap, Pop3 And Ldap?
      You can find these specific information in PHP Manual.

MYSQL DBA Interview Questions

    1. 10. How Can I Execute A Php Script Using Command Line?
      As of version 4.3.0, PHP supports a new SAPI type (Server Application Programming Interface) named CLI which means Command Line Interface. Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, “php myScript.php”, assuming “php” is the command to invoke the CLI program.
      Be aware that if your PHP script was written for the Web CGI interface, it may not execute properly in command line environment.

Drupal Tutorial

    1. 11. Suppose Your Zend Engine Supports The Mode <? ?> Then How Can U Configure Your Php Zend Engine To Support Mode ?
      In php.ini file: set short_open_tag=on
      to make PHP support

PHP5 Interview Questions

    1. 12. What Is Meant By Nl2br()?
      Inserts HTML line breaks (
      ) before all newlines in a string string nl2br (string); Returns string with ” inserted before all newlines. For example: echo nl2br(“god blessn you”) will output “god bless
      you” to your browser.

    1. 13. What Are The Reasons For Selecting Lamp (linux, Apache, Mysql, Php) Instead Of Combination Of Other Software Programs, Servers And Operating Systems?
      All of those are open source resource. Security of Linux is very very more than windows. Apache is a better server that IIS both in functionality and security. MySQL is world most popular open source database. PHP is more faster that asp or any other scripting language.
  • WordPress Tutorial

      1. 14. How Can We Encrypt And Decrypt A Data Present In A Mysql Table Using Mysql?
        AES_ENCRYPT () and AES_DECRYPT ()

     

      1. 15. What Are The Features And Advantages Of Object-oriented Programming?
        One of the main advantages of programming is its ease of modification; objects can easily be modified and added to a system there by reducing maintenance costs.
        programming is also considered to be better at modeling the real world than is procedural programming. It allows for more complicated and flexible interactions.
        systems are also easier for non-technical personnel to understand and easier for them to participate in the maintenance and enhancement of a system because it appeals to natural human cognition patterns. For some systems, an approach can speed development time since many objects are standard across systems and can be reused. Components that manage dates, shipping, shopping carts, etc. can be purchased and easily modified for a specific system

    WordPress Interview Questions

      1. 16. What Is The Use Of Friend Function?
        Sometimes a function is best shared among a number of different classes. Such functions can be declared either as member functions of one class or as global functions. In either case they can be set to be friends of other classes, by using a friend specifier in the class that is admitting them. Such functions can use all attributes of the class which names them as a friend, as if they were themselves members of that class.
        A friend declaration is essentially a prototype for a member function, but instead of requiring an implementation with the name of that class attached by the double colon syntax, a global function or member function of another class provides the match.

    1. 17. What Is The Functionality Of The Function Htmlentities?
      Convert all applicable characters to HTML entities This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.
  • Joomla Interview Questions

      1. 18. How Can We Get Second Of The Current Time Using Date Function?
        $second = date(“s”);

    1. 19. What Is The Difference Between The Functions Unlink And Unset?
      unlink() deletes the given file from the file system.
      unset() makes a variable undefined.
  • CakePHP Tutorial

      1. 20. How Can We Register The Variables Into A Session?
        $_SESSION[’name’] = “Mizan”;

    1. 21. How Can We Get The Properties (size, Type, Width, Height) Of An Image Using Php Image Functions?
      To know the Image type use exif_imagetype ()
      function To know the Image size use getimagesize ()
      function To know the image width use imagesx ()
      function To know the image height use imagesy() function t
  •  

      1. 22. How Can We Get The Browser Properties Using Php?
        By using $_SERVER[‘HTTP_USER_AGENT’] variable.

    1. 23. What Is The Maximum Size Of A File That Can Be Uploaded Using Php And How Can We Change This?
      By default the maximum size is 2MB. and we can change the following set up a php.iniupload_max_filesize = 2M
  • CodeIgniter Interview Questions

      1. 24. How Can We Increase The Execution Time Of A Php Script?
        by changing the following set up a php.inimax_execution_time = 30 ; Maximum execution time of each script, in seconds

    1. 25. How Can We Optimize Or Increase The Speed Of A Mysql Select Query?
      • first of all instead of using select * from table1, use select column1, column2, column3.. from table1
      • Look for the opportunity to introduce index in the table you are querying.
      • use limit keyword if you are looking for any specific number of rows from the result set.
  • PHP7 Tutorial

      1. 26. How Many Ways Can We Get The Value Of Current Session Id?
        session_id() returns the session id for the current session.

    1. 27. How Can We Destroy The Session, How Can We Unset The Variable Of A Session?
      session_unregister — Unregister a global variable from the current session session_unset — Free all session variables
  • MYSQL DBA Interview Questions

      1. 28. How Can We Destroy The Cookie?
        Set the cookie in past.

     

      1. 29. How Many Ways We Can Pass The Variable Through The Navigation Between The Pages?
        • GET/QueryString
        • POST

     

      1. 30. What Is The Difference Between Ereg_replace() And Eregi_replace()?
        eregi_replace() function is identical to ereg_replace() except that this ignores case distinction when matching alphabetic characters.eregi_replace() function is identical to ereg_replace() except that this ignores case distinction when matching alphabetic characters.

     

      1. 31. What Are The Different Functions In Sorting An Array?
        Sort(), arsort(), asort(), ksort(), natsort(), natcasesort(), rsort(), usort(), array_multisort(), and uksort().

     

      1. 32. How Can We Know The Count/number Of Elements Of An Array?
        2 ways

        1. sizeof($urarray) This function is an alias of count()
        2. count($urarray)

     

      1. 33. What Is The Php Predefined Variable That Tells The What Types Of Images That Php Supports?
        Though i am not sure if this is wrong or not, With the exif extension you are able to work with image meta data.

    PHP5 Interview Questions

      1. 34. How Can I Know That A Variable Is A Number Or Not Using A Javascript?
        bool is_numeric ( mixed var) Returns TRUE if var is a number or a numeric string, FALSE otherwise.or use isNaN(mixed var)The isNaN() function is used to check if a value is not a number.

     

      1. 35. List Out Some Tools Through Which We Can Draw E-r Diagrams For Mysql.
        Case Studio
        Smart Draw

     

      1. 36. List Out The Predefined Classes In Php?
        You can maintain two separate language file for each of the language. all the labels are put in both language files as variables and assign those variables in the PHP source. on runtime choose the required language option.

    WordPress Interview Questions

      1. 37. What Are The Difference Between Abstract Class And Interface?
        Abstract class: abstract classes are the class where one or more methods are abstract but not necessarily all method has to be abstract. Abstract methods are the methods, which are declare in its class but not define. The definition of those methods must be in its extending class.Interface: Interfaces are one type of class where all the methods are abstract. That means all the methods only declared but not defined. All the methods must be defined by its implemented class.

     

      1. 38. How Can We Send Mail Using Javascript?
        JavaScript does not have any networking capabilities as it is designed to work on client site. As a result we can not send mails using JavaScript. But we can call the client side mail protocol mailto via JavaScript to prompt for an email to send. this requires the client to approve it.

     

      1. 39. How Can We Repair A Mysql Table?
        The syntex for repairing a MySQL table is REPAIR TABLENAME, [TABLENAME, ], [Quick],[Extended] This command will repair the table specified if the quick is given the MySQL will do a repair of only the index tree if the extended is given it will create index row by row

     

      1. 40. How Many Values Can The Set Function Of Mysql Take?
        MySQL set can take zero or more values but at the maximum it can take 64 values

    Joomla Interview Questions

      1. 41. What Are The Other Commands To Know The Structure Of Table Using Mysql Commands Except Explain Command?
        describe Table-Name;

     

      1. 42. How Many Tables Will Create When We Create Table, What Are They?
        The ‘.frm’ file stores the table definition.
        The data file has a ‘.MYD’ (MYData) extension.
        The index file has a ‘.MYI’ (MYIndex) extension.

    CakePHP Interview Questions

      1. 43. What Is The Purpose Of The Following Files Having Extensions
        1. .frm
        2. .myd
        3. .myi? What Do These Files Contain?

         
        In MySql, the default table type is MyISAM. Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type.
        The ‘.frm’ file stores the table definition. The data file has a ‘.MYD’ (MYData) extension. The index file has a ‘.MYI’ (MYIndex) extension,

     

      1. 44. How Can We Find The Number Of Rows In A Table Using Mysql?
        Use this for mysql >SELECT COUNT(*) FROM table_name;

     

      1. 45. How Can We Find The Number Of Rows In A Result Set Using Php?
        $result = mysql_query($sql, $db_link);
        $num_rows = mysql_num_rows($result);
        echo “$num_rows rows found”;

     

      1. 46. How Many Ways We Can We Find The Current Date Using Mysql?
        SELECT CURDATE();
        CURRENT_DATE() = CURDATE()
        for time use
        SELECT CURTIME();
        CURRENT_TIME() = CURTIME()

     

      1. 47. What Type Of Inheritance That Php Supports?
        In PHP an extended class is always dependent on a single base class, that is, multiple inheritance is not supported. Classes are extended using the keyword ‘extends’.

     

      1. 48. What Are The Advantages/disadvantages Of Mysql And Php?
        Both of them are open source software (so free of cost), support cross platform. php is faster then ASP and JSP.

     

      1. 49. What Is The Difference Between Group By And Order By In Sql?
        ORDER BY [col1],[col2],…,[coln]; Tels DBMS according to what columns it should sort the result. If two rows will hawe the same value in col1 it will try to sort them according to col2 and so on.GROUP BY [col1],[col2],…,[coln]; Tels DBMS to group results with same value of column col1. You can use COUNT(col1), SUM(col1), AVG(col1) with it, if you want to count all items in group, sum all values or view average.

     

      1. 50. What Is The Difference Between Char And Varchar Data Types?
        Set char to occupy n bytes and it will take n bytes even if u r storing a value of n-m bytes
        Set varchar to occupy n bytes and it will take only the required space and will not use the n bytes
        eg. name char(15) will waste 10 bytes if we store ‘mizan’, if each char takes a byte
        eg. name varchar(15) will just use 5 bytes if we store ‘mizan’, if each char takes a byte.
        rest 10 bytes will be free.

     

      1. 51. What Is The Functionality Of Md5 Function In Php?
        Calculate the md5 hash of a string. The hash is a 32-character hexadecimal number. I use it to generate keys which I use to identify users etc. If I add random no techniques to it the md5 generated now will be totally different for the same string I am using.

     

      1. 52. How Can I Load Data From A Text File Into A Table?
        you can use LOAD DATA INFILE file_name; syntax to load data from a text file. but you have to make sure that

        1. data is delimited
        2. columns and data matched correctly

     

      1. 53. How Can We Know The Number Of Days Between Two Given Dates Using Mysql?
        SELECT DATEDIFF(’2007-03-07′,’2005-01-01′);

     

      1. 54. How Can We Know The Number Of Days Between Two Given Dates Using Php?
        $date1 = date(‘Y-m-d’);
        $date2 = ’2006-08-15′;
        $days = (strtotime($date1) – strtotime($date2)) / (60 * 60 * 24);

     

      1. 55. What Is ‘float’ Property In Css?
        The float property sets where an image or a text will appear in another element.

     

      1. 56. Are Namespaces Are There In Javascript?
        A namespace is a container and allows you to bundle up all your functionality using a unique name. In JavaScript, a namespace is really just an object that you’ve attached all further methods, properties and objects. But it is not always necessary to use namespace.

     

      1. 57. How To Get Query String In Php For Http Request?
        $_GET[] and $_REQUEST[]

     

      1. 58. How To Get The Http Request In Php?
        When PHP is used on a Web server to handle a HTTP request, it converts information submitted in the HTTP request as predefined variables:

        • $_GET – Associate array of variables submitted with GET method.
        • $_POST – Associate array of variables submitted with POST method.
        • $_COOKIE – Associate array of variables submitted as cookies.
        • $_REQUEST – Associate array of variables from $_GET, $_POST, and $_COOKIE.
        • $_SERVER – Associate array of all information from the server and the HTTP request.

     

      1. 59. How You Provide Security For Php Application?
        There are many ways to accomplish the security tasks but the most common 7 ways are

        1. Validate Input. Never trust your user and always filter input before taking it to any operation.
        2. Provide access control.
        3. Session ID protection
        4. preventing Cross Site Scripting (XSS) flaws
        5. SQL injection vulnerabilities.
        6. Turning off error reporting and exposing to the site for hackers. Instead use log file to catch exceptions
        7. Effective Data handling

     

      1. 60. What Is A Session?
        A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests.
        There is only one session object available to your PHP scripts at any time. Data saved to the session by a script can be retrieved by the same script or another script when requested from the same visitor.
        Sessions are commonly used to store temporary data to allow multiple PHP pages to offer a complete functional transaction for the same visitor.

     

      1. 61. What Is Meant By Pear In Php?
        PEAR is the next revolution in PHP. This repository is bringing higher level programming to PHP. PEAR is a framework and distribution system for reusable PHP components. It eases installation by bringing an automated wizard, and packing the strength and experience of PHP users into a nicely organised OOP library. PEAR also provides a command-line interface that can be used to automatically install “packages”

     

      1. 62. What Is A Persistent Cookie?
        A persistent cookie is a cookie which is stored in a cookie file permanently on the browser’s computer. By default, cookies are created as temporary cookies which stored only in the browser’s memory. When the browser is closed, temporary cookies will be erased. You should decide when to use temporary cookies and when to use persistent cookies based on their differences:

        • Temporary cookies can not be used for tracking long-term information.
        • Persistent cookies can be used for tracking long-term information.
        • Temporary cookies are safer because no programs other than the browser can access them.
        • Persistent cookies are less secure because users can open cookie files see the cookie values.

     

      1. 63. What Does A Special Set Of Tags Do In Php?
        What does a special set of tags do in PHP? The output is displayed directly to the browser.

     

      1. 64. How Do You Define A Constant?
        Via define() directive, like define (”MYCONSTANT”, 100);

     

      1. 65. What Are The Differences Between Require And Include, Include_once?
        require_once() and include_once() are both the functions to include and evaluate the specified file only once. If the specified file is included previous to the present call occurrence, it will not be done again.
        But require() and include() will do it as many times they are asked to do.

     

      1. 66. What Is Meant By Urlencode And Urldecode?
        urlencode() returns the URL encoded version of the given string. URL coding converts special characters into % signs followed by two hex digits.
        For example: urlencode(”10.00%”) will return “10%2E00%25″. URL encoded strings are safe to be used as part of URLs. urldecode() returns the URL decoded version of the given string.

     

      1. 67. How To Get The Uploaded File Information In The Receiving Script?
        Once the Web server received the uploaded file, it will call the PHP script specified in the form action attribute to process them. This receiving PHP script can get the uploaded file information through the predefined array called $_FILES. Uploaded file information is organized in $_FILES as a two-dimensional array as:

        • $_FILES[$fieldName][‘name’] – The Original file name on the browser system.
        • $_FILES[$fieldName][‘type’] – The file type determined by the browser.
        • $_FILES[$fieldName][‘size’] – The Number of bytes of the file content.
        • $_FILES[$fieldName][‘tmp_name’] – The temporary filename of the file in which the uploaded file was stored on the server.
        • $_FILES[$fieldName][‘error’] – The error code associated with this file upload.

        The $fieldName is the name used in the.

     

      1. 68. I Am Trying To Assign A Variable The Value Of 0123, But It Keeps Coming Up With A Different Number, What’s The Problem?
        PHP Interpreter treats numbers beginning with 0 as octal. Look at the similar PHP interview questions for more numeric problems.

     

      1. 69. Would I Use Print “$a Dollars” Or “{$a} Dollars” To Print Out The Amount Of Dollars In This Example?
        In this example it wouldn’t matter, since the variable is all by itself, but if you were to print something like “{$a},000,000 mln dollars”, then you definitely need to use the braces.

     

      1. 70. How Can We Encrypt The Username And Password Using Php?
        You can encrypt a password with the following Mysql>SET PASSWORD=PASSWORD(”Password”);

     

      1. 71. How Do You Pass A Variable By Value?
        Just like in C++, put an ampersand in front of it, like $a = &$b

     

      1. 72. What Is The Functionality Of The Functions Strstr() And Stristr()?
        string strstr ( string haystack, string needle ) returns part of haystack string from the first occurrence of needle to the end of haystack. This function is case-sensitive.
        stristr() is identical to strstr() except that it is case insensitive.

     

      1. 73. When Are You Supposed To Use Endif To End The Conditional Statement?
        When the original if was followed by : and then the code block without braces.

     

      1. 74. What Is The Functionality Of The Function Strstr And Stristr?
        strstr() returns part of a given string from the first occurrence of a given substring to the end of the string. For example: strstr(”user@example.com”,”@”) will return “@example.com”.
        stristr() is idential to strstr() except that it is case insensitive.

     

      1. 75. How Do I Find Out The Number Of Parameters Passed Into Function9?
        func_num_args() function returns the number of parameters passed in.

     

      1. 76. What Is The Purpose Of The Following Files Having Extensions: Frm, Myd, And Myi? What These Files Contain?
        In MySQL, the default table type is MyISAM.
        Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type.
        The ‘.frm’ file stores the table definition.
        The data file has a ‘.MYD’ (MYData) extension.
        The index file has a ‘.MYI’ (MYIndex) extension,

     

      1. 77. If The Variable $a Is Equal To 5 And Variable $b Is Equal To Character A, What’s The Value Of $$b?
        5, it’s a reference to existing variable.

     

      1. 78. Are Objects Passed By Value Or By Reference?
        Everything is passed by value.

     

      1. 79. What Are The Differences Between Drop A Table And Truncate A Table?
        DROP TABLE table_name – This will delete the table and its data.
        TRUNCATE TABLE table_name – This will delete the data of the table, but not the table definition.

     

      1. 80. What Are The Differences Between Get And Post Methods In Form Submitting, Give The Case Where We Can Use Get And We Can Use Post Methods?
        When we submit a form, which has the GET method it displays pair of name/value used in the form at the address bar of the browser preceded by url. Post method doesn’t display these values.

     

      1. 81. What Are The Different Types Of Errors In Php?
        Here are three basic types of runtime errors in PHP:

        1. Notices: These are trivial, non-critical errors that PHP encounters while executing a script – for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all – although you can change this default behavior.
        2. Warnings: These are more serious errors – for example, attempting to include() a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination.
        3. Fatal errors: These are critical errors – for example, instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHP’s default behavior is to display them to the user when they take place.

        Internally, these variations are represented by twelve different error types

     

      1. 82. What’s The Special Meaning Of __sleep And __wakeup?
        __sleep returns the array of all the variables than need to be saved, while __wakeup retrieves them.

     

      1. 83. Why Doesn’t The Following Code Print The Newline Properly?
        Because inside the single quotes the n character is not interpreted as newline, just as a sequence of two characters – and n.

     

      1. 84. Would You Initialize Your Strings With Single Quotes Or Double Quotes?
        Since the data inside the single-quoted string is not parsed for variable substitution, it’s always a better idea speed-wise to initialize a string with single quotes, unless you specifically need variable substitution.

     

      1. 85. What Is The Difference Between Characters 23 And x23?
        The first one is octal 23, the second is hex 23.

     

      1. 86. How Can We Submit Form Without A Submit Button?
        We can use a simple JavaScript code linked to an event trigger of any form field. In the JavaScript code, we can call the document.form.submit() function to submit the form.
        For example:

     

      1. 87. How Many Ways We Can Retrieve The Date In Result Set Of Mysql Using Php?
        As individual objects so single record or as a set or arrays.

     

      1. 88. What’s The Output Of The Ucwords Function In This Example?
        $formatted = ucwords(”FYICENTER IS COLLECTION OF INTERVIEW QUESTIONS”);
        print $formatted;
        What will be printed is FYICENTER IS COLLECTION OF INTERVIEW QUESTIONS.
        ucwords() makes every first letter of every word capital, but it does not lower-case anything else. To avoid this, and get a properly formatted string, it’s worth using strtolower() first.

     

      1. 89. What’s The Difference Between Htmlentities() And Htmlspecialchars()?
        htmlspecialchars only takes care of <, >, single quote ‘, double quote ” and ampersand. htmlentities translates all occurrences of character sequences that have different meaning in HTML.

     

      1. 90. How Can We Extract String “ap6am.com” From A String “mailto:info@ap6am.com?subject=feedback” Using Regular Expression Of Php?
        $text = “mailto:info@ap6am.com?subject=Feedback”;
        preg_match(’|.*@([^?]*)|’, $text, $output);
        echo $output[1];

        Note that the second index of $output, $output[1], gives the match, not the first one, $output[0].

     

      1. 91. So If Md5() Generates The Most Secure Hash, Why Would You Ever Use The Less Secure Crc32() And Sha1()?
        Crypto usage in PHP is simple, but that doesn’t mean it’s free. First off, depending on the data that you’re encrypting, you might have reasons to store a 32-bit value in the database instead of the 160-bit value to save on space. Second, the more secure the crypto is, the longer is the computation time to deliver the hash value. A high volume site might be significantly slowed down, if frequent md5() generation is required.

     

      1. 92. What Is The Maximum Length Of A Table Name, A Database Name, Or A Field Name In Mysql?
        Database name: 64 characters
        Table name: 64 characters
        Column name: 64 characters

     

      1. 93. What Are The Other Commands To Know The Structure Of A Table Using Mysql Commands Except Explain Command?
        DESCRIBE table_name;

     

      1. 94. What’s The Difference Between Md5(), Crc32() And Sha1() Crypto On Php?
        The major difference is the length of the hash generated. CRC32 is, evidently, 32 bits, while sha1() returns a 128 bit value, and md5() returns a 160 bit value. This is important when avoiding collisions.

     

      1. 95. Give The Syntax Of Grant Commands?
        The generic syntax for GRANT is as following
        GRANT [rights] on [database] TO [username@hostname] IDENTIFIED BY [password]
        Now rights can be:

        1. ALL privileges
        2. Combination of CREATE, DROP, SELECT, INSERT, UPDATE and DELETE etc.

        We can grant rights on all databse by using *.* or some specific database by database.* or a specific table by database.table_name.

     

      1. 96. Will Comparison Of String “10” And Integer 11 Work In Php?
        Yes, internally PHP will cast everything to the integer type, so numbers 10 and 11 will be compared.

     

      1. 97. How Can We Change The Name Of A Column Of A Table?
        This will change the name of column:
        ALTER TABLE table_name CHANGE old_colm_name new_colm_name

     

      1. 98. How Can We Change The Data Type Of A Column Of A Table?
        This will change the data type of a column:
        ALTER TABLE table_name CHANGE colm_name same_colm_name [new data type]

     

      1. 99. How Can We Know That A Session Is Started Or Not?
        A session starts by session_start() function.
        This session_start() is always declared in header portion. it always declares first. then we write session_register().

     

      1. 100. What Are The Differences Between Mysql_fetch_array(), Mysql_fetch_object(), Mysql_fetch_row()?
        mysql_fetch_array() -> Fetch a result row as a combination of associative array and regular array.
        mysql_fetch_object() -> Fetch a result row as an object.
        mysql_fetch_row() -> Fetch a result set as a regular array().

     

      1. 101. If We Login More Than One Browser Windows At The Same Time With Same User And After That We Close One Window, Then Is The Session Is Exist To Other Windows Or Not? And If Yes Then Why? If No Then Why?
        Session depends on browser. If browser is closed then session is lost. The session data will be deleted after session time out. If connection is lost and you recreate connection, then session will continue in the browser.

     

      1. 102. What Are The Mysql Database Files Stored In System ?
        Data is stored in name.myd
        Table structure is stored in name.frm
        Index is stored in name.myi

     

      1. 103. What Is The Difference Between Php4 And Php5?
        PHP4 cannot support oops concepts and Zend engine 1 is used.
        PHP5 supports oops concepts and Zend engine 2 is used.
        Error supporting is increased in PHP5.
        XML and SQLLite will is increased in PHP5.

     

      1. 104. Can We Use Include(abc.php) Two Times In A Php Page Makeit.php?
        Yes we can include that many times we want, but here are some things to make sure of:
        (including abc.PHP, the file names are case-sensitive) there shouldn’t be any duplicate function names, means there should not be functions or classes or variables with the same name in abc.PHP and makeit.php.

     

      1. 105. How Can We Encrypt And Decrypt A Data Presented In A Table Using Mysql?
        You can use functions: AES_ENCRYPT() and AES_DECRYPT() like:
        AES_ENCRYPT(str, key_str)
        AES_DECRYPT(crypt_str, key_str)

     

      1. 106. How Can I Retrieve Values From One Database Server And Store Them In Other Database Server Using Php?
        For this purpose, you can first read the data from one server into session variables. Then connect to other server and simply insert the data into the database.

     

      1. 107. Who Is The Father Of Php And What Is The Current Version Of Php And Mysql?
        Rasmus Lerdorf.
        PHP 5.1. Beta
        MySQL 5.0

     

      1. 108. In How Many Ways We Can Retrieve Data In The Result Set Of Mysql Using Php?
        mysql_fetch_array – Fetch a result row as an associative array, a numeric array, or both
        mysql_fetch_assoc – Fetch a result row as an associative array
        mysql_fetch_object – Fetch a result row as an object
        mysql_fetch_row —- Get a result row as an enumerated array

     

      1. 109. What Are The Functions For Imap?
        imap_body
        – Read the message body
        imap_check
        – Check current mailbox
        imap_delete
        – Mark a message for deletion from current mailbox
        imap_mail
        – Send an email message

     

      1. 110. What Are Encryption Functions In Php?
        CRYPT()
        MD5()

     

      1. 111. What Is The Difference Between Htmlentities() And Htmlspecialchars()?
        htmlspecialchars()
        – Convert some special characters to HTML entities (Only the most widely used)
        htmlentities()
        – Convert ALL special characters to HTML entities

     

      1. 112. How To Set Cookies?
        setcookie(’variable’,’value’,’time’);
        variable – name of the cookie variable
        value – value of the cookie variable
        time – expiry time
        Example: setcookie(’Test’,$i,time()+3600);
        Test – cookie variable name
        $i – value of the variable ‘Test’
        time()+3600 – denotes that the cookie will expire after an one hour

     

      1. 113. How To Reset/destroy A Cookie?
        Reset a cookie by specifying expire time in the past:
        Example: setcookie(’Test’,$i,time()-3600); // already expired time
        Reset a cookie by specifying its name only Example: setcookie(’Test’);

     

      1. 114. Tools Used For Drawing Er Diagrams.
        Case Studio
        Smart Draw

     

      1. 115. How Can We Submit From Without A Submit Button?
        Trigger the JavaScript code on any event ( like onSelect of dropdown listbox, onfocus, etc )
        document.myform.submit(); This will submit the form.

     

      1. 116. What Are The Current Versions Of Apache, Php, And Mysql?
        PHP: PHP 5.1.2
        MySQL: MySQL 5.1
        Apache: Apache 2.1

     

      1. 117. What Are The Features And Advantages Of Object Oriented Programming?
        One of the main advantages of programming is its ease of modification; objects can easily be modified and added to a system there by reducing maintenance costs.
        programming is also considered to be better at modeling the real world that is procedural programming. It allows for more complicated and flexible interactions.
        systems are also easier for non-technical personnel to understand and easier for them to participate in the maintenance and enhancement of a system because it appeals to natural human cognition patterns. For some systems, an approach can speed development time since many objects are standard across systems and can be reused. Components that manage dates, shipping, shopping carts, etc. can be purchased and easily modified for a specific system.

     

      1. 118. How Can I Make A Script That Can Be Bilingual (supports English, German)?
        You can change charset variable in above line in the script to support bi-language.

     

      1. 119. What’s The Difference Between Accessing A Class Method Via -> And Via ::?
        :: is allowed to access methods that can perform static operations, i.e. those, which do not require object initialization.

     

      1. 120. How Can Increase The Performance Of Mysql Select Query?
        We can use LIMIT to stop MySql for further search in table after we have received our required no. of records, also we can use LEFT JOIN or RIGHT JOIN instead of full join in cases we have related data in two or more tables.

     

      1. 121. When You Want To Show Some Part Of A Text Displayed On An Html Page In Red Font Color? What Different Possibilities Are There To Do This? What Are The Advantages /disadvantages Of These Methods?
        There are 2 ways to show some part of a text in red:

        1. Using HTML tag
        2. Using HTML tag

     

      1. 122. What Are The Different Ways To Login To A Remote Server? Explain The Means, Advantages And Disadvantages?
        There is at least 3 ways to logon to a remote server:
        Use ssh or telnet if you concern with security
        You can also use rlogin to logon to a remote server.

     

      1. 123. Please Give A Regular Expression (preferably Perl/preg Style), Which Can Be Used To Identify The Url From Within A Html Link Tag.
        Try this: /href=”([^”]*)”/i

     

      1. 124. How Many Ways We Can Give The Output To A Browser?
        HTML output
        PHP, ASP, JSP, Servlet Function
        Script Language output Function
        Different Type of embedded Package to output to a browser

     

      1. 125. What Is The Default Session Time In Php And How Can I Change It?
        The default session time in php is until closing of browser

     

      1. 126. What Changes I Have To Do In Php.ini File For File Uploading?
        Make the following line uncomment like:
        ; Whether to allow HTTP file uploads.
        file_uploads = On
        ; Temporary directory for HTTP uploaded files (will use system default if not specified).
        upload_tmp_dir = C:apache2triadtemp
        ; Maximum allowed size for uploaded files.
        upload_max_filesize = 2M

     

      1. 127. Steps For The Payment Gateway Processing?
        An online payment gateway is the interface between your merchant account and your Web site. The online payment gateway allows you to immediately verify credit card transactions and authorize funds on a customer’s credit card directly from your Web site. It then passes the transaction off to your merchant bank for processing, commonly referred to as transaction batching

     

      1. 128. How Many Ways I Can Redirect A Php Page?
        Here are the possible ways of php page redirection.

        1. Using Java script:
          ‘; echo ‘window.location.href=”‘.$filename.’”;’; echo ”; echo ”; echo ”; echo ”; } } redirect(’https://interviewquestions.ap6am.com’); ?>
        2. Using php function: header(”Location:https://interviewquestions.ap6am.com “);

     

      1. 129. List Out Different Arguments In Php Header Function?
        void header ( string string [, bool replace [, int http _ response _ code]])

     

      1. 130. What Type Of Headers Have To Be Added In The Mail Function To Attach A File?
        $boundary = ‘–’ .md5(uniqid(rand()));
        $headers = “From: ”Me”n”;
        $headers .= “MIME-Version: 1.0n”;
        $headers .= “Content-Type: multipart/mixed;
        boundary=”$boundary””;

     

      1. 131. What Is The Difference Between Reply-to And Return-path In The Headers Of A Mail Function?
        Reply-to:
        Reply-to is where to delivery the reply of the mail.
        Return-path:
        Return path is when there is a mail delivery failure occurs then where to delivery the failure notification.

     

      1. 132. How To Turn On The Session Support?
        The session support can be turned on automatically at the site level, or manually in each PHP page script:

        • Turning on session support automatically at the site level: Set session.auto_start = 1 in php.ini.
        • Turning on session support manually in each page script: Call session_start() function.

     

      1. 133. Explain The Ternary Conditional Operator In Php?
        Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed.

     

      1. 134. What’s The Difference Between Include And Require?
        It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.

     

      1. 135. How To Read The Entire File Into A Single String?
        If you have a file, and you want to read the entire file into a single string, you can use the file_get_contents() function. It opens the specified file, reads all characters in the file, and returns them in a single string. Here is a PHP script example on how to file_get_contents():
        $file = file_get_contents(”/windows/system32/drivers/etc/services”);
        print(”Size of the file: “.strlen($file).”n”);
        ?>
        This script will print:
        Size of the file: 7116