*Friday CLOSED

Timings 10.00 am - 08.00 pm

Call : 021-3455-6664, 0312-216-9325 DHA 021-35344-600, 03333808376, ISB 03333808376

PHP + MYSQL Job Interview Questions & Answers in Malaysia Kuala Lumpur, Penang, Selangor

image_pdfSave PDFimage_printPrint
PHP + MYSQL Job Interview Q&A

PHP + MYSQL Job Interview Questions & Answers Karachi Pakistan Dubai

Getting prepared for PHP+MySQL job? Do not panic, we will guide you how and what to answer in your interview. If you are preparing for PHP+MySQL job interview then go through Omni Academy interview questions and answers page. PHP+MySQL is very powerful in accessing the database. PHP is a server side scripting language which helps in creating dynamic web content. If SQL is embedded in the script, it will access the database using the connection and fetches the data. If it is insert function, data base is added with new row and similar to the update and delete options. This can be done using built in libraries like MySQLi, PDO and etc. Please have a look at PHP+MySQL interview questions and answers page to win your interview.

PHP+MySQL Interview Questions And Answers

  • Question 1. Who Is The Father Of Php And Explain The Changes In Php Versions?Answer :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
  • Question 2. How Can We Submit A Form Without A Submit Button?Answer :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).
  • Question 3. In How Many Ways We Can Retrieve The Data In The Result Set Of Mysql Using Php?Answer :You can do it by 4 Ways
    1. mysql_fetch_row.
    2. mysql_fetch_array
    3. mysql_fetch_object
    4. mysql_fetch_assoc
  • Question 4. What Is The Difference Between Mysql_fetch_object And Mysql_fetch_array?Answer :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).
  • Question 5. What Is The Difference Between $message And $$message?Answer :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.
  • Question 6. How Can We Create A Database Using Php And Mysql?Answer :We can create MySQL database with the use of mysql_create_db(“Database Name”)
  • Question 7. Can We Use Include (“abc.php”) Two Times In A Php Page “makeit.php”?Answer :Yes we can use include() more than one time in any page though it is not a very good practice.
  • Question 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)) ?Answer :
    Total 5 types of tables we can create
    1. MyISAM
    2. Heap
    3. Merge
    4. INNO DB
    5. ISAMMyISAM 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.
  • Question 9. Functions In Imap, Pop3 And Ldap?Answer :You can find these specific information in PHP Manual.
  • Question 10. How Can I Execute A Php Script Using Command Line?Answer :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.
  • Question 11. Suppose Your Zend Engine Supports The Mode <? ?> Then How Can U Configure Your Php Zend Engine To Support <?php ?> Mode ?Answer :In php.ini file: set short_open_tag=on to make PHP support
  • Question 12. What Is Meant By Nl2br()?Answer :Inserts HTML line breaks (<BR/>) before all newlines in a string string nl2br (string); Returns string with ” inserted before all newlines. For example: echo nl2br(“god bless\n you”) will output “god bless <br/>you” to your browser.
  • Question 13. What Are The Reasons For Selecting Lamp (linux, Apache, Mysql, Php) Instead Of Combination Of Other Software Programs, Servers And Operating Systems?Answer :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.
  • Question 14. How Can We Encrypt And Decrypt A Data Present In A Mysql Table Using Mysql?Answer :AES_ENCRYPT () and AES_DECRYPT ()
  • Question 15. What Are The Features And Advantages Of Object-oriented Programming?Answer :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
  • Question 16. What Is The Use Of Friend Function?Answer :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.
  • Question 17. What Is The Functionality Of The Function Htmlentities?Answer :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.
  • Question 18. How Can We Get Second Of The Current Time Using Date Function?Answer :$second = date(“s”);
  • Question 19. What Is The Difference Between The Functions Unlink And Unset?Answer :unlink() deletes the given file from the file system.unset() makes a variable undefined.
  • Question 20. How Can We Register The Variables Into A Session?Answer :$_SESSION[’name’] = “Mizan”;
  • Question 21. How Can We Get The Properties (size, Type, Width, Height) Of An Image Using Php Image Functions?Answer :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
  • Question 22. How Can We Get The Browser Properties Using Php?Answer :By using $_SERVER[‘HTTP_USER_AGENT’] variable.
  • Question 23. What Is The Maximum Size Of A File That Can Be Uploaded Using Php And How Can We Change This?Answer :By default the maximum size is 2MB. and we can change the following set up a php.iniupload_max_filesize = 2M
  • Question 24. How Can We Increase The Execution Time Of A Php Script?Answer :by changing the following set up a php.inimax_execution_time = 30 ; Maximum execution time of each script, in seconds
  • Question 25. How Can We Optimize Or Increase The Speed Of A Mysql Select Query?Answer :
    • 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.
  • Question 26. How Many Ways Can We Get The Value Of Current Session Id?Answer :session_id() returns the session id for the current session.
  • Question 27. How Can We Destroy The Session, How Can We Unset The Variable Of A Session?Answer :session_unregister — Unregister a global variable from the current session session_unset — Free all session variables
  • Question 28. How Can We Destroy The Cookie?Answer :Set the cookie in past.
  • Question 29. How Many Ways We Can Pass The Variable Through The Navigation Between The Pages?Answer :
    • GET/QueryString
    • POST
  • Question 30. What Is The Difference Between Ereg_replace() And Eregi_replace()?Answer :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.
  • Question 31. What Are The Different Functions In Sorting An Array?Answer :Sort(), arsort(), asort(), ksort(), natsort(), natcasesort(), rsort(), usort(), array_multisort(), and uksort().
  • Question 32. How Can We Know The Count/number Of Elements Of An Array?Answer :2 ways
    1. sizeof($urarray) This function is an alias of count()
    2. count($urarray) 
  • Question 33. What Is The Php Predefined Variable That Tells The What Types Of Images That Php Supports?Answer :Though i am not sure if this is wrong or not, With the exif extension you are able to work with image meta data.
  • Question 34. How Can I Know That A Variable Is A Number Or Not Using A Javascript?Answer :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.
  • Question 35. List Out Some Tools Through Which We Can Draw E-r Diagrams For Mysql.Answer :Case StudioSmart Draw
  • Question 36. List Out The Predefined Classes In Php?Answer :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.
  • Question 37. What Are The Difference Between Abstract Class And Interface?Answer :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.
  • Question 38. How Can We Send Mail Using Javascript?Answer :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.
  • Question 39. How Can We Repair A Mysql Table?Answer :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
  • Question 40. How Many Values Can The Set Function Of Mysql Take?Answer :MySQL set can take zero or more values but at the maximum it can take 64 values
  • Question 41. What Are The Other Commands To Know The Structure Of Table Using Mysql Commands Except Explain Command?Answer :describe Table-Name;
  • Question 42. How Many Tables Will Create When We Create Table, What Are They?Answer :The ‘.frm’ file stores the table definition.
    The data file has a ‘.MYD’ (MYData) extension.
    The index file has a ‘.MYI’ (MYIndex) extension.
  • Question 43. What Is The Purpose Of The Following Files Having Extensions
    1. .frm
    2. .myd
    3. .myi? What Do These Files Contain?Answer :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,
  • Question 44. How Can We Find The Number Of Rows In A Table Using Mysql?Answer :Use this for mysql >SELECT COUNT(*) FROM table_name;
  • Question 45. How Can We Find The Number Of Rows In A Result Set Using Php?Answer :$result = mysql_query($sql, $db_link);
    $num_rows = mysql_num_rows($result);
    echo “$num_rows rows found”;
  • Question 46. How Many Ways We Can We Find The Current Date Using Mysql?Answer :SELECT CURDATE(); CURRENT_DATE() = CURDATE() for time use SELECT CURTIME(); CURRENT_TIME() = CURTIME()
  • Question 47. What Type Of Inheritance That Php Supports?Answer :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’.
  • Question 48. What Are The Advantages/disadvantages Of Mysql And Php?Answer :Both of them are open source software (so free of cost), support cross platform. php is faster then ASP and JSP.
  • Question 49. What Is The Difference Between Group By And Order By In Sql?Answer :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.
  • Question 50. What Is The Difference Between Char And Varchar Data Types?Answer :Set char to occupy n bytes and it will take n bytes even if u r storing a value of n-m bytesSet varchar to occupy n bytes and it will take only the required space and will not use the n byteseg. name char(15) will waste 10 bytes if we store ‘mizan’, if each char takes a byteeg. name varchar(15) will just use 5 bytes if we store ‘mizan’, if each char takes a byte.rest 10 bytes will be free.
  • Question 51. What Is The Functionality Of Md5 Function In Php?Answer :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.
  • Question 52. How Can I Load Data From A Text File Into A Table?Answer :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
  • Question 53. How Can We Know The Number Of Days Between Two Given Dates Using Mysql?Answer :SELECT DATEDIFF(’2007-03-07′,’2005-01-01′);
  • Question 54. How Can We Know The Number Of Days Between Two Given Dates Using Php?Answer :$date1 = date(‘Y-m-d’); $date2 = ’2006-08-15′; $days = (strtotime($date1) – strtotime($date2)) / (60 * 60 * 24);
  • Question 55. What Is ‘float’ Property In Css?Answer :The float property sets where an image or a text will appear in another element.
  • Question 56. Are Namespaces Are There In Javascript?Answer :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.
  • Question 57. How To Get Query String In Php For Http Request?Answer :$_GET[] and $_REQUEST[]
  • Question 58. How To Get The Http Request In Php?Answer :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.
  • Question 59. How You Provide Security For Php Application?Answer :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
  • Question 60. What Is A Session?Answer :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.
  • Question 61. What Is Meant By Pear In Php?Answer :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”
  • Question 62. What Is A Persistent Cookie?Answer :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. 
  • Question 63. What Does A Special Set Of Tags Do In Php?Answer :What does a special set of tags do in PHP? The output is displayed directly to the browser.
  • Question 64. How Do You Define A Constant?Answer :Via define() directive, like define (”MYCONSTANT”, 100);
  • Question 65. What Are The Differences Between Require And Include, Include_once?Answer :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.
  • Question 66. What Is Meant By Urlencode And Urldecode?Answer :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.
  • Question 67. How To Get The Uploaded File Information In The Receiving Script?Answer :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<INPUT TYPE=FILE, NAME=fieldName>.
  • Question 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?Answer :PHP Interpreter treats numbers beginning with 0 as octal. Look at the similar PHP interview questions for more numeric problems.
  • Question 69. Would I Use Print “$a Dollars” Or “{$a} Dollars” To Print Out The Amount Of Dollars In This Example?Answer :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.
  • Question 70. How Can We Encrypt The Username And Password Using Php?Answer :You can encrypt a password with the following Mysql>SET PASSWORD=PASSWORD(”Password”); 
  • Question 71. How Do You Pass A Variable By Value?Answer :Just like in C++, put an ampersand in front of it, like $a = &$b
  • Question 72. What Is The Functionality Of The Functions Strstr() And Stristr()?Answer :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.
  • Question 73. When Are You Supposed To Use Endif To End The Conditional Statement?Answer :When the original if was followed by : and then the code block without braces.
  • Question 74. What Is The Functionality Of The Function Strstr And Stristr?Answer :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.
  • Question 75. How Do I Find Out The Number Of Parameters Passed Into Function9?Answer :func_num_args() function returns the number of parameters passed in.
  • Question 76. What Is The Purpose Of The Following Files Having Extensions: Frm, Myd, And Myi? What These Files Contain?Answer :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,
  • Question 77. If The Variable $a Is Equal To 5 And Variable $b Is Equal To Character A, What’s The Value Of $$b?Answer :5, it’s a reference to existing variable.
  • Question 78. Are Objects Passed By Value Or By Reference?Answer :Everything is passed by value.
  • Question 79. What Are The Differences Between Drop A Table And Truncate A Table?Answer :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.
  • Question 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?Answer :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.
  • Question 81. What Are The Different Types Of Errors In Php?Answer :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
  • Question 82. What’s The Special Meaning Of __sleep And __wakeup?Answer :__sleep returns the array of all the variables than need to be saved, while __wakeup retrieves them.
  • Question 83. Why Doesn’t The Following Code Print The Newline Properly? <?php $str = ‘hello, There.\nhow Are You?\nthanks For Visiting Fyicenter’; Print $str; ?>Answer :Because inside the single quotes the \n character is not interpreted as newline, just as a sequence of two characters – \ and n.
  • Question 84. Would You Initialize Your Strings With Single Quotes Or Double Quotes?Answer :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.
  • Question 85. What Is The Difference Between Characters 23 And \x23?Answer :The first one is octal 23, the second is hex 23.
  • Question 86. How Can We Submit Form Without A Submit Button?Answer :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:<input type=button value=”Save” onClick=”document.form.submit()”>
  • Question 87. How Many Ways We Can Retrieve The Date In Result Set Of Mysql Using Php?Answer :As individual objects so single record or as a set or arrays.
  • Question 88. What’s The Output Of The Ucwords Function In This Example?Answer :$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.
  • Question 89. What’s The Difference Between Htmlentities() And Htmlspecialchars()?Answer :htmlspecialchars only takes care of <, >, single quote ‘, double quote ” and ampersand. htmlentities translates all occurrences of character sequences that have different meaning in HTML.
  • Question 90. How Can We Extract String “wisdomjobs.com” From A String “mailto:info@wisdomjobs.com?subject=feedback” Using Regular Expression Of Php?Answer :$text = “mailto:info@wisdomjobs.com.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].
  • Question 91. So If Md5() Generates The Most Secure Hash, Why Would You Ever Use The Less Secure Crc32() And Sha1()?Answer :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.
  • Question 92. What Is The Maximum Length Of A Table Name, A Database Name, Or A Field Name In Mysql?Answer :Database name: 64 characters
    Table name: 64 characters
    Column name: 64 characters
  • Question 93. What Are The Other Commands To Know The Structure Of A Table Using Mysql Commands Except Explain Command?Answer :DESCRIBE table_name;
  • Question 94. What’s The Difference Between Md5(), Crc32() And Sha1() Crypto On Php?Answer :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.
  • Question 95. Give The Syntax Of Grant Commands?Answer :The generic syntax for GRANT is as followingGRANT [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.
  • Question 96. Will Comparison Of String “10” And Integer 11 Work In Php?Answer :Yes, internally PHP will cast everything to the integer type, so numbers 10 and 11 will be compared.
  • Question 97. How Can We Change The Name Of A Column Of A Table?Answer :This will change the name of column:ALTER TABLE table_name CHANGE old_colm_name new_colm_name
  • Question 98. How Can We Change The Data Type Of A Column Of A Table?Answer :This will change the data type of a column:ALTER TABLE table_name CHANGE colm_name same_colm_name [new data type]
  • Question 99. How Can We Know That A Session Is Started Or Not?Answer :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().
  • Question 100. What Are The Differences Between Mysql_fetch_array(), Mysql_fetch_object(), Mysql_fetch_row()?Answer :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().
  • Question 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?Answer :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.
  • Question 102. What Are The Mysql Database Files Stored In System ?Answer :Data is stored in name.mydTable structure is stored in name.frmIndex is stored in name.myi
  • Question 103. What Is The Difference Between Php4 And Php5?Answer :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.
  • Question 104. Can We Use Include(abc.php) Two Times In A Php Page Makeit.php?Answer :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.
  • Question 105. How Can We Encrypt And Decrypt A Data Presented In A Table Using Mysql?Answer :You can use functions: AES_ENCRYPT() and AES_DECRYPT() like:AES_ENCRYPT(str, key_str)
    AES_DECRYPT(crypt_str, key_str)
  • Question 106. How Can I Retrieve Values From One Database Server And Store Them In Other Database Server Using Php?Answer :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.
  • Question 107. Who Is The Father Of Php And What Is The Current Version Of Php And Mysql?Answer :Rasmus Lerdorf.
    PHP 5.1. Beta
    MySQL 5.0
  • Question 108. In How Many Ways We Can Retrieve Data In The Result Set Of Mysql Using Php?Answer :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
  • Question 109. What Are The Functions For Imap?Answer :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
  • Question 110. What Are Encryption Functions In Php?Answer :CRYPT()
    MD5()
  • Question 111. What Is The Difference Between Htmlentities() And Htmlspecialchars()?Answer :htmlspecialchars() – Convert some special characters to HTML entities (Only the most widely used)
    htmlentities() – Convert ALL special characters to HTML entities
  • Question 112. How To Set Cookies?Answer :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
  • Question 113. How To Reset/destroy A Cookie?Answer :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’);
  • Question 114. Tools Used For Drawing Er Diagrams.Answer :Case Studio
    Smart Draw
  • Question 115. How Can We Submit From Without A Submit Button?Answer :Trigger the JavaScript code on any event ( like onSelect of dropdown listbox, onfocus, etc )
    document.myform.submit(); This will submit the form.
  • Question 116. What Are The Current Versions Of Apache, Php, And Mysql?Answer :PHP: PHP 5.1.2
    MySQL: MySQL 5.1
    Apache: Apache 2.1
  • Question 117. What Are The Features And Advantages Of Object Oriented Programming?Answer :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.
  • Question 118. How Can I Make A Script That Can Be Bilingual (supports English, German)?Answer :You can change charset variable in above line in the script to support bi-language.
  • Question 119. What’s The Difference Between Accessing A Class Method Via -> And Via ::?Answer ::: is allowed to access methods that can perform static operations, i.e. those, which do not require object initialization.
  • Question 120. How Can Increase The Performance Of Mysql Select Query?Answer :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.
  • Question 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?Answer :There are 2 ways to show some part of a text in red:
    1. Using HTML tag <font color=”red”>
    2. Using HTML tag <span style=”color: red”>
  • Question 122. What Are The Different Ways To Login To A Remote Server? Explain The Means, Advantages And Disadvantages?Answer :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.
  • Question 123. Please Give A Regular Expression (preferably Perl/preg Style), Which Can Be Used To Identify The Url From Within A Html Link Tag.Answer :Try this: /href=”([^”]*)”/i
  • Question 124. How Many Ways We Can Give The Output To A Browser?Answer :HTML output
    PHP, ASP, JSP, Servlet Function
    Script Language output Function
    Different Type of embedded Package to output to a browser
  • Question 125. What Is The Default Session Time In Php And How Can I Change It?Answer :The default session time in php is until closing of browser
  • Question 126. What Changes I Have To Do In Php.ini File For File Uploading?Answer :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:\apache2triad\temp; Maximum allowed size for uploaded files.
    upload_max_filesize = 2M
  • Question 127. Steps For The Payment Gateway Processing?Answer :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
  • Question 128. How Many Ways I Can Redirect A Php Page?Answer :Here are the possible ways of php page redirection.
    1. Using Java script:
      ‘; echo ‘window.location.href=”‘.$filename.’”;’; echo ”; echo ”; echo ”; echo ”; } } redirect(’http://wisdomjobs.com’); ?>
    2. Using php function: header(”Location:http://wisdomjobs.com “);
  • Question 129. List Out Different Arguments In Php Header Function?Answer :void header ( string string [, bool replace [, int http _ response _ code]])
  • Question 130. What Type Of Headers Have To Be Added In The Mail Function To Attach A File?Answer :$boundary = ‘–’ .md5(uniqid(rand())); $headers = “From: \”Me\”\n”; $headers .= “MIME-Version: 1.0\n”; $headers .= “Content-Type: multipart/mixed; boundary=\”$boundary\””;
  • Question 131. What Is The Difference Between Reply-to And Return-path In The Headers Of A Mail Function?Answer :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.
  • Question 132. How To Turn On The Session Support?Answer :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.
  • Question 133. Explain The Ternary Conditional Operator In Php?Answer :Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed.
  • Question 134. What’s The Difference Between Include And Require?Answer :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.
  • Question 135. How To Read The Entire File Into A Single String?Answer :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():<?php
    $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

Recommended Courses -Learn Online Now!

Advanced Diploma in Web Development (Fed Govt. Program)

Digital Marketing Course

Social Media Marketing for Business Growth (2 Months Approx)

Search Engine Optimization – Advanced SEO(2 Months Approx)

Python programming – Mastering Paython

Mobile Application Development

Diploma in 3DS Max – Animation & Visualizer
Diploma in Graphics & Animation Course
AUTOCAD 2D 3D Course

sharing is caring

Leave a Reply


ABOUT US

OMNI ACADEMY & CONSULTING is one of the most prestigious Training & Consulting firm, founded in 2010, under MHSG Consulting Group aim to help our customers in transforming their people and business - be more engage with customers through digital transformation. Helping People to Get Valuable Skills and Get Jobs.

Read More

Contact Us

Get your self enrolled for unlimited learning 1000+ Courses, Corporate Group Training, Instructor led Class-Room and ONLINE learning options. Join Now!
  • Head Office: A-2/3 Westland Trade Centre, Shahra-e-Faisal PECHS Karachi 75350 Pakistan Call 0213-455-6664 WhatsApp 0334-318-2845, 0336-7222-191, +92 312 2169325
  • Gulshan Branch: A-242, Sardar Ali Sabri Rd. Block-2, Gulshan-e-Iqbal, Karachi-75300, Call/WhatsApp 0213-498-6664, 0331-3929-217, 0334-1757-521, 0312-2169325
  • ONLINE INQUIRY: Call/WhatsApp +92 312 2169325, 0334-318-2845, Lahore 0333-3808376, Islamabad 0331-3929217, Saudi Arabia 050 2283468
  • DHA Branch: 14-C, Saher Commercial Area, Phase VII, Defence Housing Authority, Karachi-75500 Pakistan. 0213-5344600, 0337-7222-191, 0333-3808-376
  • info@omni-academy.com
  • FREE Support | WhatsApp/Chat/Call : +92 312 2169325
WORKING HOURS

  • Monday10.00am - 7.00pm
  • Tuesday10.00am - 7.00pm
  • Wednesday10.00am - 7.00pm
  • Thursday10.00am - 7.00pm
  • FridayClosed
  • Saturday10.00am - 7.00pm
  • Sunday10.00am - 7.00pm
WhatsApp Us