Top PHP Interview questions – 06
801. .How would you break up a delimited string into an array of substrings? 802. What regular expression syntax would you use to match the letterâ€b†at ;least once but not more than six...
801. .How would you break up a delimited string into an array of substrings? 802. What regular expression syntax would you use to match the letterâ€b†at ;least once but not more than six...
500. when calling urls from a mysql database how do you make them active links on screen in php 501. How do I change this into a link? <?php echo $row_rsLocations ['CODE'] ; ?>...
401. How can i include a PHP PAGE on a non-php server?… I mean i want include a SIMPLE php page… 402. Why can't I get PHPSESSID to work (PWS on NT WorkStation 4.0,...
201. What is the PHP equivelent of ColdFusion's <CFHTTP> tag? (Both GET and POST operations) 202. What I do wrong to connect to a mysql DB-> Call to unsupported or undefined function mysql_connect() 203....
101. How do I write a php script within a php script to a file without escaping everything? 102. How can I create a dropdown for date field showing past 3 months, present month...
1. What Is PHP ? 2. How can I disable the output of error messages inside the HTML page? 3. Can I return other file formats (like Word, Excel, etc) using PHP? 4. Is...
Questions : 81 How we load all classes that placed in different directory in one PHP File , means how to do auto load classes Answer : 81 by using spl_autoload_register(‘autoloader::funtion’); Like below class...
Questions : 61 What are the other commands to know the structure of table using MySQL commands except explain command? Answer : 61 describe Table-Name; Questions : 62 How many tables will create when...
Questions : 21 How can we encrypt the username and password using PHP? Answers : 21 The functions in this section perform encryption and decryption, and compression and uncompression: encryption decryption AES_ENCRYT() AES_DECRYPT() ENCODE()...
Questions : 1 What is Full form of PHP ? Who is the father or inventor of PHP ? Answers : 1 Rasmus Lerdorf is known as the father of PHP that started development of...
How to store the uploaded file to the final location? move_uploaded_file ( string filename, string destination) This function checks to ensure that the file designated by filename is a valid upload file (meaning that...
How can I set a cron and how can I execute it in Unix, Linux, and windows? Cron is very simply a Linux module that allows you to run commands at predetermined times or...
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...
What is maximum size of a database in mysql? If the operating system or filesystem places a limit on the number of files in a directory, MySQL is bound by that constraint. The efficiency...
What is the use of friend function? Friend functions 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...
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’); What types...
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 In how many ways we can retrieve data in the result...
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(). What...
Give the syntax of REVOKE commands? The generic syntax for revoke is as following REVOKE [rights] on [database] FROM [username@hostname] Now rights can be: a) ALL privileges b) Combination of CREATE, DROP, SELECT, INSERT,...
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 What are the...
How can we register the variables into a session? session_register($session_var); $_SESSION[‘var’] = ‘value’; What is the difference between characters \023 and \x23? The first one is octal 23, the second is hex 23. With...
This can be used for comments and other from of communication to tell the time ago instead of the exact time which might not be correct to some one in another time zone. The...
<?php $zip = zip_open(“zip.zip”); if (is_resource($zip)) { while ($zip_entry = zip_read($zip)) { $fp = fopen(“zip/”.zip_entry_name($zip_entry), “w”); if (zip_entry_open($zip, $zip_entry, “r”)) { $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); fwrite($fp,”$buf”); zip_entry_close($zip_entry); fclose($fp); } } zip_close($zip); } ?>
Why doesn’t the following code print the newline properly? <?php $str = ‘Hello, there.\nHow are you?\nThanks for visiting techpreparation’; print $str; ?> Because inside the single quotes the \n character is not interpreted as...
What is the difference between ereg_replace() and eregi_replace()? eregi_replace() function is identical to ereg_replace() except that it ignores case distinction when matching alphabetic characters. How do I find out the number of parameters passed...
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...
How do you define a constant? Via define() directive, like define (“MYCONSTANT”, 100); What are the differences between require and include, include_once? Anwser 1: require_once() and include_once() are both the functions to include and...
What’s PHP ? The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications. What...
/* * @param string $file Filepath * @param string $query Needed information (0 = width, 1 = height, 2 = mime-type) * @return string Fileinfo */ function getImageinfo($file, $query) { if (!realpath($file)) { $file...
Accounts for proxies: if (!empty($_SERVER[‘HTTP_CLIENT_IP’])) { $ip=$_SERVER[‘HTTP_CLIENT_IP’]; } elseif (!empty($_SERVER[‘HTTP_X_FORWARDED_FOR’])) { $ip=$_SERVER[‘HTTP_X_FORWARDED_FOR’]; } else { $ip=$_SERVER[‘REMOTE_ADDR’]; }