PHP interview questions, Part 1 Web dev interview questions Feel free to post the answers and discuss

the questions in the comments. Mizanur Rahman also posted some detailed answers on his blog. 1. 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? 2. Who is the father of PHP and explain the changes in PHP versions? 3. How can we submit a form without a submit button? 4. In how many ways we can retrieve the date in the result set of mysql using PHP? 5. What is the difference between mysql_fetch_object and mysql_fetch_array? 6. What is the difference between $message and $$message? 7. How can we extract string ‘techinterviews.com ‘ from a string ‘http://www.techinterviews.com’ using regular expression of PHP? 8. How can we create a database using PHP and mysql? 9. What are the differences between require and include, include_once? 10. Can we use include (”techinterviews.php”) two times in a PHP page “makeit.PHP”? 11. 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)) ? 12. Functions in IMAP, POP3 AND LDAP? 13. How can I execute a PHP script using command line? 14. Suppose your Zend engine supports the mode <? ?> Then how can u configure your PHP Zend engine to support <?PHP ?> mode ? 15. Shopping cart online validation i.e. how can we configure Paypal, etc.? 16. What is meant by nl2br()? 17. Draw the architecture of Zend engine? 18. What are the current versions of apache, PHP, and mysql? 19. What are the reasons for selecting lamp (linux, apache, mysql, PHP) instead of combination of other software programmes, servers and operating systems? 20. How can we encrypt and decrypt a data present in a mysql table using mysql? 21. How can we encrypt the username and password using PHP? 22. What are the features and advantages of object-oriented programming? 23. What are the differences between procedure-oriented languages and objectoriented languages? 24. What is the use of friend function? 25. What are the differences between public, private, protected, static, transient, final and volatile? 26. What are the different types of errors in PHP? 27. What is the functionality of the function strstr and stristr? 28. What are the differences between PHP 3 and PHP 4 and PHP 5? 29. How can we convert asp pages to PHP pages? 30. What is the functionality of the function htmlentities? 31. How can we get second of the current time using date function? 32. How can we convert the time zones using PHP? 33. What is meant by urlencode and urldocode? 34. What is the difference between the functions unlink and unset?

1

35. How can we register the variables into a session? 36. How can we get the properties (size, type, width, height) of an image using PHP image functions? 37. How can we get the browser properties using PHP? 38. What is the maximum size of a file that can be uploaded using PHP and how can we change this? 39. How can we increase the execution time of a PHP script? 40. How can we take a backup of a mysql table and how can we restore it. ? 41. How can we optimize or increase the speed of a mysql select query? 42. How many ways can we get the value of current session id? 43. How can we destroy the session, how can we unset the variable of a session? 44. How can we destroy the cookie? 45. How many ways we can pass the variable through the navigation between the pages? 46. What is the difference between ereg_replace() and eregi_replace()? 47. What are the different functions in sorting an array? 48. How can we know the count/number of elements of an array? 49. What is the PHP predefined variable that tells the What types of images that PHP supports? 50. How can I know that a variable is a number or not using a JavaScript? 51. List out some tools through which we can draw E-R diagrams for mysql. 52. How can I retrieve values from one database server and store them in other database server using PHP? 53. List out the predefined classes in PHP? 54. How can I make a script that can be bilanguage (supports English, German)? 55. What are the difference between abstract class and interface? 56. How can we send mail using JavaScript?

chandu said, 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). visit http://in2.php.net/mysql_fetch_object and http://in2.php.net/mysql_fetch_array for more info chandu said, Answer for Q6) can be found at http://www.phpbuilder.com/columns/robert20000928.php3 chandu said, Answer to Q7)

2

$exploded[1] should have abc.com chandu said, answer to Q8) mysql_create_db() should work chandu said, Answer to Q9) require_once(),include_once() both the functions include and evalute the specified file only once and if the specified file is opened previous to the present call occurrance, it will not be done again. But require() and include() will do it as many times they are asked to do. chandu said, answer to q10) 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 shouldnt 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 chandu said, correction to my previous comment: I’v specified functions,classes and variables, exactly what I meant with variables is…u’v to make sure that the variables wont over write each other. chandu said, Answer to Q)11 Refer the Page http://dev.mysql.com/doc/mysql/en/storage-engines.html meenakshi said, get is like query string all the variables will be displayed in he url where as post is the standard way of sending th evariables meenakshi said, Ques 2 Father of php is Rasmus Lerdorf and for version info and changes see this link http://www.php.net/ChangeLog-4.php#4.1.0 meenakshi said,

3

q5 mysql_fetch_object is like fetching value from a recordset and mysql_fetch_array is gettin array’s value sukhbir said, ans_16 nl2br() inserts html in string echo nl2br(”god bless \n you”); output god bless you D R Jadav said, Answer for Q.1 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. D R Jadav said, Answer of Question 1: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. D R Jadav said, Answer of Question no 5 : 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). Note: Field names returned by this function are case-sensitive. field; /* this is invalid */ echo $row->0; ?> D R Jadav said, Answer of question no 6: $message is variable whereas $$message is Dynamic variable. eg. $user=”bob”

4

is equivalent to $holder=”user”; $$holder=”bob”; D R Jadav said, Answer of Question 7 : Use the function split split(“@”,”http://info@abc.com”) which returns an array any second element of the returned array will hold the value as abc.com. D R Jadav said, Answer of Question no 8 : We can create MySQL database with the use of mysql_create_db(“Database”) D R Jadav said, Answer of Question no 9 : The include_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the include() statement, with the only difference being that if the code from a file has already been included, it will not be included again. The major difference between include() and require() is that in failure include produces a warning message whereas require produces a Fatal errors. D R Jadav said, Answer of Question no 10 : Yes we can use include() more than once in same page. D R Jadav said, Answer of Question no 11 : Table Types are · ISAM(Index Sequential Access Method) · MyISAM o Static o Dynamic o Compress · Merge · Heap (Fastest tables because it stores in to the RAM) · BDB · InnoDB (Transaction safe table)

5

D R Jadav said.php. D R Jadav said. Answer of Question no 21 : You can encrypt a password with the following Mysql>SET PASSWORD=PASSWORD(“Password”). string str2) this function search the string str1 for the first occurrence of the string str2 and returns the part of the string str1 6 .When you fire the above create query MySQL will create the Dynamic table. D R Jadav said. Answer of Question no 27 : string strstr ( string str1.org www.com D R Jadav said. Answer of Question no 18 : For information about latest version of Apache. www. Answer of Question no 16 : Returns string with ” inserted before all newlines D R Jadav said. Php and Mysql please visits the following sites respectively. By default location of php parser is /var/www/html so set the path of this directory and just use as following #php sample. How can I execute a PHP script using command line? Through php parse you can execute PHP script using command line.net www. Answer of Question no 13 : 13.apache.mysql.php D R Jadav said. Answer of Question no 26 : Three are three types of errors 1) Fatal errors 2) Parser errors 3) Startup errors.

myform.uk?subject=”+tdata+”/MYFORM”. 56. 53.value. Praveen said. D R Jadav said. 7 .from the first occurrence of the string str2.List out the predefined classes in PHP? Predefined Classes 1. This function is case-sensitive and for case-insensitive search use stristr() function. How can we send mail using JavaScript? The answer for this question function myfunction(form) { tdata=document. Standard Defined Classes These classes are defined in the standard set of functions included in the PHP build. } Shatabdi said. nl2br (PHP 3.cc.naken.ac. this will output : foo isn’t bar Grant Harding said. Answer of Question no 29 : You can download asp2php front end application from the site http://asp2php. PHP 4 ) nl2br — Inserts HTML line breaks before all newlines in a string QUES TION 16 string nl2br ( string string) Returns string with ” inserted before all newlines. I hope you aren’t aiming for a job in the field. return true. Is it really in the best interest of both employers and job-seekers to have the answers for this available? If you can’t answer many of these basic questions. Shatabdi said. These simple answers come with experience and practice. location=”mailto:dep7abc@leeds.tbox1.

and will only be available when that extension has either been compiled into PHP or dynamically loaded at runtime. swffont h. swfdisplayitem i. swfaction l. a. swftextfield g. swfbutton k.swfshape b.stdClass 2. qtdom Defined Classes These classes are defined in the qtdom extension. Directory The class from which dir() is instantiated. swftext f. swfmorph m. swffill c. b. QDomDocument 8 . swfgradient d.a. swfmovie j. and will only be available when that extension has either been compiled into PHP or dynamically loaded at runtime. Oracle 8 Defined Classes These classes are defined in the Oracle 8 extension. OCI-Lob b. and will only be available when that extension has either been compiled into PHP or dynamically loaded at runtime.Ming Defined Classes These classes are defined in the Ming extension. swfsprite 3. a. OCI-Collection 4. swfbitmap e. a.

then you can use “GET” Method. When user click on checkbox. At the end of the form I will type “Click here to submit” & link text to the processing file ————————————————– 4) In how many ways we can retrieve the date in the result set of mysql using PHP? ————————————————– 5) What is the difference between mysql_fetch_object and mysql_fetch_array? Ans : Speed-wise.g. ————————————————– 2) Who is the father of PHP and explain the changes in PHP versions? Ans : Rasmus Lerdorf is the father of PHP ————————————————– 3) How can we submit a form without a submit button? Ans : I can submit a form in many ways. But for long data sending say more then 100 character you can use “POST” method. QDomNode Bharati Raul said.an object is returned. 1) What are the differences between Get and post methods in form submitting. When user click on radio button 3. 1. give the case where we can use get and we can use post methods? Ans : When you want to send short or small data. You can see the output which you are sending in the addressbar. mysql_fetch_object() is similar to mysql_fetch_array(). Whereas if you send the form with “POST” method then user can not see that information. instead of an array. Indirectly. with one difference . for e. and not by their offsets 9 . and almost as quick as mysql_fetch_row() (the difference is insignificant). not containing ASCII characters. Once most imp diff is when you are sending the form with “Get” method. or drop down 2.b. that means that you can only access the data by the field names. the function is identical to mysql_fetch_array().

Heap 3. ————————————————– 9) What are the differences between require and include. but is there is any problem include() generate a warning message where as require() generates the fatal error. include_once? ANS : include() & require() .same as include() and require() but if file is already included then does not produce any error or not include that file again ————————————————– 10) Can we use include (”abc.com’ using regular expression of PHP? Ans : echo substr(”http://info@abc. MyISAM 2. include_once() & require_once() . ISAM MyISAM is the default storage engine as of MySQL 3.12. which type of table is generated when we are creating a table in the following syntax: create table employee(eno int(2). Merge 4. ————————————————– 6) What is the difference between $message and $$message? Ans : $message is variable whereas $$message is dynamic varibale ————————————————– Bharati Raul said.(numbers are illegal property names). ————————————————– 8) How can we create a database using PHP and mysql? ANS : mysql_create_db(”Database_Name”).com ‘ from a string ‘http://info@abc. 7) How can we extract string ‘abc.PHP”? Ans : Yes we can include two times and more then two times also ————————————————– 11) What are the different tables present in mysql. INNO DB 5.19).23.PHP”) two times in a PHP page “makeit. ————————————————– Kumar said.includes the file during the execution of the script.ename varchar(10)) ? Ans : Total 5 types of tables we can create 1.com”. 10 .

You aren’t really ’sending mail’ when doing a ‘mailto’ and so it’s a misleading question… A smart candidate would just say “It’s not possible” and you may write him off. AES_ENCRYPT() and AES_DECRYPT() Mikhail Esteves said. What is the difference between the functions unlink and unset? unlink is a function for file system handling. Q 20. 11 . It will simply delete the file in context unset will set UNSET the variable.g Kumar said. How can we destroy the cookie? Set the cookie in past Kumar said.What is meant by urlencode and urldocode? string urlencode(str) where str contains a string like this “hello world” and the return value will be URL encoded and can be use to append with URLs. ramesh said. How can we know the count/number of elements of an array? 2 ways a) sizeof($urarray) This function is an alias of count() b) count($urarray) interestingly if u just pass a simple var instead of a an array it will return 1. e.com?var=hello%world string urldocode(str) this will simple decode the GET variable’s value Like it echo (urldecode($_GET_VARS[var])) will o/p “Hello world” Kumar said. normaly used to appned data for GET like someurl. Pujitha Sendanayake said. How can we register the variables into a session? session_register($ur_session_var). Question 56: This question is wrong. some information about zend engine. Kumar said.

net/manual/en/function.php. q47. like storing or updating data. . I got the job anyway.net/manual/en/function. WHAT IS THE DIFFERENCE BETWEEN GET & POST? Get is an Idompotent method.rsort.co.net/manual/en/function. Pujitha Sendanayake said.sort.php http://www.arsort.asort. Some answers may be wrong. asort-http://www.net/manual/en/function. 52 for this purpose we have first read the data from one server into session varaibles.php. 6 $message is simple variable.)”GET” is basically for just getting (retrieving: quering db for data & retriving) data whereas “POST” may involve anything.net/manual/en/function.mlinux.php ksort-http://www. Q46eregi_replace() function is identical to ereg_replace() except that this ignores case distinction when matching alphabetic characters. so shouldnt be completly crap.php rsort-http://www. and then connect to other server and simply insert the data into the database Rahul Amrutkar said. or ordering a product. Ans Q.zend.php uksort-http://www.php.-) puremango.net/manual/en/function. Q.php natsort-http://www. or sending Email.zend. $$message is reference variable. PUT and DELETE share this property. In GET form data is to be encoded (by a browser) into a URL while the 12 .org/projects/present/zend/ http://www.php arsort-http://www.php.net/manual/en/function.php. The methods GET.natsort.uk 1. HEAD. Sorting functions in PHP.uksort.php.krsort. Mallu Indian said.ksort.php.php Pujitha Sendanayake said.net/manual/en/function.http://www.php sort-http://www.php krsort-http://www.php Rahul Amrutkar said.com/zend/zend-engine-summary.php. (Idompotent: The side-effects of N > 0 identical requests is the same as for a single request.com/store/products/zend-engine.

083 Characters in Internet Explorer (Q208427) or approximatly 1k. For GET in IE. WHAT IS THE DIFFERENCE BETWEEN $MESSAGE AND $$MESSAGE? $message is a variable $$message is a variable variable. A variable variable allows us to change the name of a variable dynamically. HOW CAN WE SUBMIT A FORM WITHOUT A SUBMIT BUTTON? form.0 3. PHP 5. a numeric array. Maximum URL Length Is 2. } else { echo ‘Error creating database: ‘ . 2. WHO IS THE FATHER OF PHP AND WHAT IS THE CURRENT IN PHP & MYSQLVERSION? Rasmus Lerdorf. 7. HOW CAN WE EXTRACT STRING ‘ABC.latter means that the form data is to appear within a message body.1. $link)) { echo “Database my_db created successfully\n”. mysql_error() . IN HOW MANY WAYS WE CAN RETRIEVE THE DATE IN THE RESULT SET OF MYSQL USING PHP? mysql_fetch_array — Fetch a result row as an associative array. or both mysql_fetch_object — Fetch a result row as an OBJECT 6.COM’ FROM A STRING ‘HTTP://INFO@ABC.WHAT IS THE DIFFERENCE BETWEEN MYSQL_FETCH_OBJECT AND MYSQL_FETCH_ARRAY? mysql_fetch_array — Fetch a result row as an associative 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 5. Beta MySQL 5. if (mysql_query($sql. a numeric array. “\n”.submit(). 4.COM’ USING REGULAR EXPRESSION OF PHP? 8. } 13 . HOW CAN WE CREATE A DATABASE USING PHP AND MYSQL? $sql = ‘CREATE DATABASE my_db’.

WHAT ARE THE DIFFERENCES BETWEEN REQUIRE AND INCLUDE.ENAME VARCHAR(10)) ? MyISAM: This is default. 10.PHP”) TWO TIMES IN A PHP PAGE “MAKEIT. CAN WE USE INCLUDE (”ABC. The include_once() statement includes and evaluates the specified file during the execution of the script. POP3 AND LDAP? 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 13.PHP”? YES 11. HOW CAN I EXECUTE A PHP SCRIPT USING COMMAND LINE? As of version 4. If the file is not present. SUPPOSE YOUR ZEND ENGINE SUPPORTS THE MODE THEN HOW CAN U CONFIGURE YOUR PHP ZEND ENGINE TO SUPPORT MODE ? Its already supported.9. Cannot have BLOB.0. Based on Indexed Sequntial Access Method. FUNCTIONS IN IMAP. with the only difference being that if the code from a file has already been included. but will loose data if there is a crash. WHAT IS MEANT BY NL2BR()? 14 . it will not be included again. Slower that others. INCLUDE_ONCE? All three are used to an include file into the current page.3. This is a behavior similar to the include() statement. WHICH TYPE OF TABLE IS GENERATED WHEN WE ARE CREATING A TABLE IN THE FOLLOWING SYNTAX: CREATE TABLE EMPLOYEE(ENO INT(2). It des not call a fatal error if file not exists. The above SQL will create a MyISA table. InoDB : same as BDB 12. calls a fatal error. 15. require_once() does the same as include_once(). but it calls a fatal error if file not exists. WHAT ARE THE DIFFERENT TABLES PRESENT IN MYSQL. PHP supports a new SAPI type (Server Application Programming Interface) named CLI which means Command Line Interface. require(). TEXT & AUTO INCRIMENT fields BDB : Supports Transactions using COMMIT & ROLLBACK. It is faster than include(). 14. while in include() does not. ISAM : same HEAP : Fast data access.

WHAT ARE THE DIFFERENCES BETWEEN PUBLIC. STATIC.although you can change this default behaviour. instantiating an object of a non-existent class. FINAL AND VOLATILE? 19. 3. TRANSIENT. DIFFERENCE BETWEEN HTMLENTITIES() AND HTMLSPECIALCHARS()] 15 . $domain = strstr($email.com’. but they do not result in script termination.key_str) . Notices: These are trivial. Fatal errors: These are critical errors . Internally. WHAT ARE THE DIFFERENT TYPES OF ERRORS IN PHP? here are three basic types of runtime errors in PHP: 1.for example. echo $domain. non-critical errors that PHP encounters while executing a script . ‘@’). By default. ENCRYPTION FUNCTIONS IS PHP CRYPT() MD5() 18.com stristr() is the case insensitive version of strstr() 21. these errors are displayed to the user. These errors cause the immediate termination of the script. PROTECTED.Returns string with after inserting HTML line breaks before all newlines in a string 16. PRIVATE.for example. and PHP’s default behaviour is to display them to the user when they take place. By default. HOW CAN WE ENCRYPT AND DECRYPT A DATA PRESENT IN A MYSQL TABLE USING MYSQL? AES_ENCRYPT(str. // prints @example. such errors are not displayed to the user at all . attempting to include() a file which does not exist. or calling a non-existent function. AES_DECRYPT(crypt_str. these variations are represented by twelve different error types 20. 2. WHAT IS THE FUNCTIONALITY OF THE FUNCTIONS STRSTR() AND STRISTR()? string strstr ( string haystack. $email = ‘user@example. Warnings: These are more serious errors . accessing a variable that has not yet been defined.for example.key_str) 17. string needle ) Returns part of haystack string from the first occurrence of needle to the end of haystack.

HOW CAN WE GET THE PROPERTIES (SIZE. WIDTH. HOW CAN WE TAKE A BACKUP OF A MYSQL TABLE AND HOW CAN WE RESTORE IT. HOW CAN WE INCREASE THE EXECUTION TIME OF A PHP SCRIPT? Use set_time_limit(int) where int is the number of seconds for execution of the script. HEIGHT) OF AN IMAGE USING PHP IMAGE FUNCTIONS? getimagesize — Get the size of an image image_type_to_extension — Get file extension for image type imagesx — Get image width imagesy — Get image height 26.htmlspecialchars : Convert some special characters to HTML entities (Only the most widley used) htmlentities : Convert ALL special characters to HTML entities 22. WHAT IS THE DIFFERENCE BETWEEN THE FUNCTIONS UNLINK AND UNSET? unlink: is used to delete a file unset is used to destroy an eralier declared variable 24.ini file: upload_max_filesize integer The maximum size of an uploaded file. When an integer is used. 25. If it’s set to 0 it’s unlimited. TYPE. Default value is 30. HOW CAN WE REGISTER THE VARIABLES INTO A SESSION? $_SESSION[’name’] = “Chinmay”. WHAT IS MEANT BY URLENCODE AND URLDOCODE? urlencode : Returns a string in which all non-alphanumeric characters except -_. the value is measured in bytes. To destroy a session: unset($_SESSION[’name’]). urldocode : Decodes URL-encoded string 23. have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs. ? 16 . 28. UPLOAD FILE SIZE In Php. 27.

To backup: BACKUP TABLE tbl_name[. If you do not have any GRANT statements done. -t. –no-data Don’t write any row information for the table.time()+3600).cookie variable name $i . COOKIES setcookie(”variable”. OPTIMISING QUERIES First.tbl_name…] TO ‘/path/to/backup/directory’ RESTORE TABLE tbl_name[.$i.”value”. Test .name of the cookie variable variable . // already expired time Reset a cookie by specifying its name only setcookie(”test”).denotes that the cookie will expire after an one hour 31. The dump will contain SQL statements to create the table and/or populate the table. variable .”time”). This is very useful if you just want to get a dump of the structure for a table! 29. HOW TO RESET/DESTROY A COOKIE Reset a cookie by specifying expiry time Example: setcookie(”test”.time()-3600). So if you have a very high volume it may be worth the time to avoid grants. 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 17 . the more overhead you get. more permission check results in a larger overhead.tbl_name…] FROM ‘/path/to/backup/directory’ mysqldump: Dumping Table Structure and Data Utility to dump a database or a collection of database for backup or for transferring the data to another SQL server (not necessarily a MySQL server).value of the cookie variable time . Otherwise. -d.$i. one thing that affects all queries: The more complex permission system setup you have.value of the variable ‘Test’ time()+3600 . –no-create-info Don’t write table creation information (the CREATE TABLE statement). MySQL will optimise the permission checking somewhat. 30.expiry time Example: setcookie(”test”. 32.

None of you got the Q7 right… you need to pay attention the question clearly satates that a _regex_ has to be used…. the script will run for a total of 45 seconds before timing out.. mahesh said. eek. WHAT TYPES OF IMAGES THAT PHP SUPPORTS? imagetypes — Return the image types supported by this PHP build This function returns a bit-field corresponding to the image formats supported by the version of GD linked into PHP.33. imagetypes() example 34. By the use of void set_time_limit ( int seconds) Set the number of seconds a script is allowed to run. 18 . To check for PNG support. for example. TOOLS USED FOR DRAWING ER DIAGRAMS. and 25 seconds into script execution a call such as set_time_limit(20) is made. if(parseInt(myValue)== myValue) alert(’Integer’). what is it? u24 said. if it exists. IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM. ah well. 35. set_time_limit() restarts the timeout counter from zero. The default limit is 30 seconds or. The following bits are returned. When called. Richa said. the script returns a fatal error. In other words.. no time limit is imposed. CHECK IF A VARIABLE IS INTEGER IN JAVASCRIPT var myValue =9. If seconds is set to zero. too many on regex. if the timeout is the default 30 seconds. else alert(’Not’). the max_execution_time value defined in the php.8.ini. Case Studio Smart Draw matts said. I got most of these questions when i attended a interview at brainay consulting. hyd. my php was removed. How can we increase the execution time of a PHP script? ans. do this: Example 1. If this is reached. Q.

5 will return string with ” inserted before newlines instead of ”. Q. bool is_numeric ( mixed var) Returns TRUE if var is a number or a numeric string.What is meant by nl2br()? ans. preg_match(”|[^@]*@(. FALSE otherwise.0. Ans (14) In php.sitepoint. $output).Q. nl2br() is now XHTML compliant. 7 Answer.How can I execute a PHP script using command line? ans . Question No. $text. How can I know that a variable is a number or not using a JavaScript? ans. Example 1. using nl2br() this will output : foo isn’t bar Subir said. Note: Starting with PHP 4. any on can tell me how can we recieve textfield valu on next page in php when set global off for security purpuse.0.5. All versions before 4.*)|im”. 19 .ini file: set short_open_tag=on to make PHP support parmanand said. without usin GET POST REQUEST HTTP_VARS global arrays Viral Hirpara said. nl2br — Inserts HTML line breaks before all newlines in a string Description string nl2br ( string string) Returns string with ” inserted before all newlines.com/article/phpcommand-line-1 Q. Check the following url: http://www.

wonderful answers on php questions." Major Difference In simple words.$output will give result in second index of array. GET: we are submitting a form to login. when we do ’submit’ or similar action to post the form.com said. POST is assumed more secure and we can send lot more data than that of GET method is limited(they say Internet Explorer can take care of maximum 2083 character as a query string).. For Q#1 What are "Get" and "Post"? Get and Post are methods used to send data to the server: With the Get method.php’) and is retrieved by login. Look at the similar PHP interview questions for more numeric problems./login. With the Post method. what’s the problem? . A requirement for the survey is that it asks questions in several pages (first 20 . This is really helpful for the php candidates willing to appear for an interview PHP interview questions < TechInterviews. […] ShailC said. ex: Assume we are logging in with username and password.php. Wow.php by $_POST[’username’] and $_POST[’password’]. HI I am working on a website and am trying to make an online survey using PHP and MySQL.. in POST method data is sent by standered input (nothing shown in url when posting while in GET method data is sent through query string. Arvind said. but it keeps coming up with a different number.php?username&password’ as url when executing the script login. the data is sent as "standard input. means $output[1] is answer.php. the browser appends the data onto the URL. […] I am trying to assign a variable the value of 0123.php by $_GET[’username’] and $_GET[’password’]./login. when we do ’submit’ or similar action to post the form values are sent through ‘visible’ query string (notice ‘. values are sent through ‘invisible’ standered input (notice ‘.PHP Interpreter treats numbers beginning with 0 as octal. Satnam said. POST :we are submitting a form to login. I have a few problems: 1.php)and is retrieved by login.

+)$/’.com ‘ from a string ‘http://info@abc. Please let me know how to send the data to same row till one whole cycle is completed and start sending data to new row when a new user starts the survey. I would be very thankful if some1 can provide me technical help regarding this. Thanks a lot Ashik Rahman said.com”. These are really “Short BUT Sufficient” answers on php questions. echo $found[1]. 6th question answer is $message and $$message both are variable declarations. How can we extract string ‘abc. Vikas Bhambi said.$found). $message=”ValueA” $$message is equal to $($message)=$ValueA tarangini said.+@(. shyambabu said.'http://info@abc. I need PHP script for reading the top ten values and minimum ten values of a colomn and take their average.com’ using regular expression of PHP? preg_match(’/^http:\/\/.\/]+$/”. It is really helpful for the Freshers willing to appear for an interview for PHP. 2. preg_match(”/^(http:\/\/)?([^\/]+)/i”. $host. preg_match(”/[^\@. “info@abc.once it goes to next page (on clicking continue) the data is sent into a new row and rest of the fields that were filled on previous page are left blank. $matches). $matches).These questions r very usefull to us. $host = $matches[2].\/]+\.[^\.a set of 5 Qs and then click Continue and then again next 5 and again Continue and so on) I know how to send data to database and the values to different colomns but I dont know how to send data to same row for one person…. 21 . 3.com’. Many of these questions i faced in interview when i attend an interview in technofy . I also want script for rating on scale of 1-7 and yes no percentage. echo “domain name is: {$matches[0]}\n”. Slava said.

submit(). Carrie Underwood said. $data). 50. 22 .com”. Carrie Underwood said. PHP Docs said. Mohammed Ismail said. 56. The value to be tested Jesse said. Old way (deprecated): $var = ‘value’.sendeamil.sendeamil. echo $data[2]. Syntax isNaN(number) Parameter Description number Required. How can we register the variables into a session? $_SESSION[’var’] = ‘value’.”http://info@abc. Q7) preg_match(”/^(http:\/\/info@)?([^\/]+)/i”. 56.Slava said. How can we send mail using JavaScript? document. How can I know that a variable is a number or not using a JavaScript? Definition and Usage The isNaN() function is used to check if a value is not a number. session_register(’var’). How can I execute a PHP script using command line? #php -F Carrie Underwood said.submit(). How can we send mail using JavaScript? document.

. What is the difference between $message and $$message? Ans:Both are variables only $message is a variable and if used with print statement. $data). Not advisable if you are sending login info like password etc. 23 . How many ways we can retrieve the date in result set of mysql using php? Ans:As individual objects so single record or as a set or arrays. etc ) document.Question : Difference between mysql_connect and mysql_pconnnect skonealone said. Hi all.com”.”http://info@abc. What are the differences between Get and post methods in form submitting.com’ using regular _expression of php? Ans:preg_match(”/^(http:\/\/info@)?([^\/]+)/i”. Who is the father of php and explain the changes in php versions? Ans :Rasmus Lerdorf for version changes goto http://php.myform. What is the difference between mysql_fetch_object and mysql_fetch_array? Ans:MySQL fetch object will collect first single matching record where mysql_fetch_array will collect all matching records from the table in an array 6. give the case where we can use get and we can use post methods? Ans :In the get method the data made available to the action page ( where data is received ) by the URL so data can be seen in the address bar. the content of the $message variable will be displayed. the content of the $message will also be treated as variable and the content of that variable will be displayed.submit().com ‘ from a string ‘http://info@abc. 5. How can we submit from without a submit button? Ans:Trigger the JavaScript code on any event ( like onselect of drop down list box.This will submit the form.net/ 3. echo $data[2]. 7. 4.. For ex: If $message contains “var”. In the post method the data will be available as data blocks and not as query string in case of get method. Where as with $$message variable. onfocus. here are the answer for most of the questions post. 1. 2. How can we extract string ‘abc. then it displays the content of $var on the screen.

How can I execute a PHP script using command line? Ans:Through php parse you can execute PHP script using command line. include_once? Ans:File will not be included more than once. Heap 3.Use the function split split(“@”. if u not specified any table type then default will be applied and MyISAM is default 13. Merge 4.php”? Ans:Yes we can include. Can we use include (”abc. etc. What are the differences between require and include. http://dev.html MyISAM Table Type is created..ename varchar(10)) ? Ans:Total 5 types of tables we can create 1.”http://info@abc. ISAM MyISAM is the default storage engine as of MySQL 3. variable value reassignments.com”) which returns an array any second element of the returned array will hold the value as abc. Table Types are · ISAM(Index Sequential Access Method) · MyISAM o Static o Dynamic o Compress · Merge · Heap (Fastest tables because it stores in to the RAM) · BDB · InnoDB (Transaction safe table) When you fire the above create query MySQL will create the Dynamic table.com/doc/mysql/en/storage-engines. If we want to include a file once only and further calling of the file will be ignored then we have to use the PHP function include_once().com. 8. INNO DB 5. 10. MyISAM 2. What are the different tables present in mysql. How can we create a database using php and mysql? Ans:mysql_create_db() 9. which type of table is generated when we are creating a table in the following syntax: create table employee(eno int(2).php”) two times in a php page “makeit. By default location of php parser is /var/www/html so set the path of this 24 . This will prevent problems with function redefinitions. 11.mysql.23.

What are the differences between PHP 3 and PHP 4 and PHP 5? Ans:for this ans goto http://php. 27. How can we convert asp pages to PHP pages? Ans:You can download asp2php front end application from the site http://asp2php. normaly used to appned data for GET like someurl. 26. string str2) this function search the string str1 for the first occurrence of the string str2 and returns the part of the string str1 from the first occurrence of the string str2. What is the functionality of the function strstr and stristr? Ans:string strstr ( string str1.directory and just use as following #php sample. How can we encrypt the username and password using PHP? Ans:You can encrypt a password with the following Mysql>SET PASSWORD=PASSWORD(”Password”). What are the different types of errors in PHP? Ans:Three are three types of errors 1) Fatal errors 2) Parser errors 3) Startup errors.php 16. This function is case-sensitive and for case-insensitive search use stristr() function. How can we encrypt and decrypt a data present in a mysql table using mysql? Ans:AES_ENCRYPT() and AES_DECRYPT() 21.naken. What is meant by urlencode and urldocode? Ans:string urlencode(str) where str contains a string like this “hello world” and the return value will be URL encoded and can be use to append with URLs. 33.cc.net and check the version changes 29. output– god bless you Returns string with ‘’ inserted before all newlines 20.com?var=hello%world 25 . What is meant by nl2br()? Ans:nl2br() inserts html in string echo nl2br(”god bless \n you”). 28.

rsort.sort. How can we register the variables into a session? Ans:Yes we can session_register($ur_session_var).php.php. What is the difference between the functions unlink and unset? Ans:unlink is a function for file system handling.php. how can we unset the variable of a session? Ans:session_unregister — Unregister a global variable from the current session session_unset — Free all session variables 44. It will simply delete the file in context unset will set UNSET the variable.asort.php.net/manual/en/function. How many ways can we get the value of current session id? ans:session_id() returns the session id for the current session.php.php 26 .net/manual/en/function.net/manual/en/function.php ksort-http://www. How many ways we can pass the variable through the navigation between the pages? Ans:GET or QueryString and POST 46.natsort. e.net/manual/en/function. How can we destroy the cookie? Ans:Set the cookie in past 45.krsort.uksort.php krsort-http://www.php rsort-http://www.ksort.php. 43.g 35.php. asort-http://www.php natsort-http://www.arsort.net/manual/en/function.string urldocode(str) this will simple decode the GET variable’s value Like it echo (urldecode($_GET_VARS[var])) will output “Hello world” 34.net/manual/en/function. What are the different functions in sorting an array? Ans:Sorting functions in PHP. 47.eregi_replace() function is identical to ereg_replace() except that this ignores case distinction when matching alphabetic characters. How can we destroy the session. What is the difference between ereg_replace() and eregi_replace()? Ans:eregi_replace() function is identical to ereg_replace() except that this ignores case distinction when matching alphabetic characters. 42.net/manual/en/function.php arsort-http://www.php.net/manual/en/function.php sort-http://www.php uksort-http://www.

48. swfsprite 27 . How can we know the count/number of elements of an array? Ans:2 ways a) sizeof($urarray) This function is an alias of count() b) count($urarray) interestingly if u just pass a simple var instead of a an array it will return 1. b. swfmorph m. Standard Defined Classes These classes are defined in the standard set of functions included in the PHP build. a. and will only be available when that extension has either been compiled into PHP or dynamically loaded at runtime. 53.stdClass 2. Directory The class from which dir() is instantiated. swfdisplayitem i.swfshape b. swfmovie j. swffont h. swfaction l. swfgradient d. swffill c. swfbutton k. a. swftextfield g. swfbitmap e.Ming Defined Classes These classes are defined in the Ming extension. swftext f. List out the predefined classes in PHP? Ans:1.

Oracle 8 Defined Classes These classes are defined in the Oracle 8 extension. You aren’t really ’sending mail’ when doing a ‘mailto’ and so it’s a misleading question… A smart candidate would just say “It’s not possible” and you may write him off.tbox1. PEAR is a framework and distribution system for reusable PHP components. OCI-Lob b. QDomDocument b. 57.myform. It eases installation by bringing an automated wizard. What is meant by PEAR in php? Ans:PEAR is the next revolution in PHP. QDomNode 56. 28 . } This question is wrong. a. What is the purpose of the following files having extensions 1) frm 2) MYD 3) MYI. Each MyISAM table is stored on disk in three files. and packing the strength and experience of PHP users into a nicely organised OOP library. a. PEAR also provides a command-line interface that can be used to automatically install “packages” 58. qtdom Defined Classes These classes are defined in the qtdom extension. and will only be available when that extension has either been compiled into PHP or dynamically loaded at runtime. What these files contains? Ans:In MySql.value. Using clientside email client function myfunction(form) { tdata=document. OCI-Collection 4. return true. and will only be available when that extension has either been compiled into PHP or dynamically loaded at runtime. This repository is bringing higher level programming to PHP. location=”mailto:mailid@domain. the default table type is MyISAM.3. How can we send mail using JavaScript? Ans:No You can’t send mail using Javascript but u can execute a client side email client to send the email using mailto: code. The files have names that begin with the table name and have an extension to indicate the file type.com?subject=”+tdata+”/MYFORM”.

Thankyou Archana said. PHP can be executed from Command Line. Q8.frm’ file stores the table definition. Answer to Q. The data file has a `. Thankyou Nithin said.it will be more useful for people who are seeking php jobs and useful for the interviews. I am really satisfied with the questions and the different answers given. now u can have little idea abt the php frm these answers… and if u hv better answer dan i posted pls email me at skone.com’ using regular expression of PHP? $ext = strrchr(‘http://info@abc.This can be of great help for people looking for a bulk of questions to be asked in interviews.com’ .com ‘ from a string ‘http://info@abc.sk@gmail. The CLI SAPI was released for the first time with PHP 4.How can we extract string ‘abc. Question 27: What is the functionality of the function strstr and stristr? strstr function used to find first occurrence of a string ex: stristr function is an Case-insensitive strstr ex: jeeva arulraj said.2. //output will be abc.MYD’ (MYData) extension. The index file has a `. well i tryed myself to answer most of the questions. but was still experimental and had to be explicitly enabled with –enable-cli when 29 .com regards -skonealone ( shekhar koli) Nosherwan Adil said..and may be u may get more robost answer for these questions.com Priya said..The `. 13. using the SAP Interface (SAPI) or Server Application Programming Interface named CLI which means Command Line Interface. I am really satisfied with the questions and the different answers given.MYI’ (MYIndex) extension. ‘@’ ).0.but two many answers make the readers more confusion.

in Mobile: 91-9841467284 30 . Ans of 3.3. It passes value in the form of Object and we can submit large data from the form.0 the CLI SAPI is no longer experimental and the option –enable-cli is on by default. tell me about Undefined offset when i use do & while loop $count=0. R. //echo $child_name. <a href=”void(0)” rel=”nofollow”>Submit Me</a> Nitesh said.itechindia.co. 3.running . $count=$count+1. Nitesh said.Karuppaiah Team Leader I Tech Indis (p) Ltd Chennai. Q. Ans of 3. Nitesh said. You may use –disable-cli to disable it. parth said. Ans of 1: When we submit a form./configure. India.com Email: iam_karu@yahoo. We can submit a form without a submit button with javascript. We can submit a form without a submit button with the help of javascript. admin said. How can we submit a form without a submit button? Answer: We can submit a from without a submit button help ho javascript like. where Child[] takenas array Nitesh said. Website: http://www. $child_name=$_POST[”child”][$count]. } while($child_name>= 0).$_POST[”child”][$count]. Since PHP 4. which has the GET method it pass value in the form of query string (set of name/value pair) and display along with URL.”". do { echo”The enter Name of your child is”. With GET we can a small data submit from the form (a set of 255 character) whereas Post method doesn’t display value with URL.

we can call the document. What is the difference between mysql_fetch_object and mysql_fetch_array? MySQL fetch object will collect first single matching record where mysql_fetch_array will collect all matching records from the table in an array. For example: preg_match("/.com ‘ from a string ‘http://info@a…’ using regular _expression of php? We can use the preg_match() function with "/. On the browser side.$data). echo $data[1]. The $_GET array stores data submitted by the GET method. 7.*@(.net/ Marco Tabini is the founder and publisher of php|architect. What is the difference between $message and $$message? They are both variables. 6.*)$/" as the regular expression pattern. 3. 2. But $message is a variable with a fixed name.form. the main difference between GET and POST is where the submitted is stored. $ $message is a variable who’s name is stored in $message. give the case where we can use get and we can use post methods? On the server side. For example: 4. 5.1. The $_POST array stores data submitted by the POST method.submit() function to submit the form. For example. $$message is the same as $var. if $message contains "var". How can we submit from without a submit button? We can use a simple JavaScript code linked to an event trigger of any form field. Who is the father of php and explain the changes in php versions? Rasmus Lerdorf for version changes go to http://php. What are the differences between GET and POST methods in form submitting. GET method is mostly used for submitting a small amount and less sensitive data.*) $/". POST method is mostly used for submitting a large amount or sensitive data. In the JavaScript code. 31 . 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.com". How can we extract string ‘abc. Data submitted by the POST method will not be displayed anywhere on the browser."http://info@abc. the difference is that data submitted by the GET method will be displayed in the browser’s address field.*@(.

What are the differences between require and include. 12.ename varchar(10)) ? Total 5 types of tables we can create 1. How can I execute a php script using command line? Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. it may not execute properly in command line environment. which type of table is generated when we are creating a table in the following syntax: create table employee(eno int(2). This will prevent problems with function redefinitions.php..23. What are the different tables present in mysql. variable value reassignments.net/ldap 13. 9. Be aware that if your PHP script was written for the Web CGI interface.php"? Yes we can include. Functions in IMAP. 32 . If we want to include a file once only and further calling of the file will be ignored then we have to use the PHP function include_once().net/imap http://uk2.php") two times in a php page "makeit. POP3 AND LDAP? Please visit: http://fi2. How can we create a database using php and mysql? PHP: mysql_create_db() Mysql: create database.php".php. Merge 4. include_once? File will not be included more than once. InnoDB 5. 10. "php myScript. BDB MyISAM is the default storage engine as of MySQL 3. Can we use include ("abc. MyISAM 2.8. Heap 3. ISAM 6. For example. etc. 11. assuming "php" is the command to invoke the CLI program.

We can encode data using base64_encode($string) and can decode using base64_decode($string). What are the reasons for selecting lamp (Linux. and mysql? PHP: php5. Php is more faster that asp or any other scripting language. Draw the architecture of ZEND engine? 18. For example: echo nl2br("god bless\n you") will output "god bless \n you" to your browser. 20. apache. It allows for more complicated and flexible interactions.14. Shopping cart online validation i. Then your php ZEND engine support only mode. Apache is a better server that IIS both in functionality and security.1. Mysql is world most popular open source database. What are the current versions of apache.1 Apache: Apache 2. What are the features and advantages of OBJECT ORIENTED PROGRAMMING? One of the main advantages of OO programming is its ease of modification. How can we encrypt the username and password using php? You can encrypt a password with the following Mysql>SET PASSWORD=PASSWORD("Password").e. OO programming is also considered to be better at modeling the real world than is procedural programming. 22. mysql. php.2 MySQL: MySQL 5.ini file. servers and operating systems? All of those are open source resource. OO systems are also easier for non- 33 . Suppose your ZEND engine supports the mode Then how can u configure your php ZEND engine to support mode ? If you change the line: short_open_tag = off in php. What is meant by nl2br()? nl2br — Inserts HTML line breaks before all newlines in a string string nl2br (string). php) instead of combination of other software programs.1 19. 17. objects can easily be modified and added to a system there by reducing maintenance costs. Security of linux is very very more than windows. How can we encrypt and decrypt a data present in a mysql table using mysql? AES_ENCRYPT () and AES_DECRYPT () 21. how can we configure the paypals? 16. 15. Returns string with ” inserted before all newlines.

fulfillment system. See Fig. a change log. all these pieces of code must be found. Components that manage dates. The information within an object is encapsulated (or hidden) from the rest of the system.. determines if it is a business day or a holiday. Tuesday. modified. and tested. What are the differences between PROCEDURE ORIENTED LANGUAGES and OBJECT ORIENTED LANGUAGES? Traditional programming has the following characteristics: Functions are written sequentially. If a function is used multiple times in a system (i. (for example.e. 23.. order function. Code (sequences of computer instructions) and data (information on which the instructions operates on) are kept separate. an object may be created around "date") The object would contain all information and functionality for that thing (A date object it may contain labels like January. Multiple sets of code and data are required to work together. a request is sent asking for specific information. When one object needs information from another object. For some systems. One set of code may rely on data in multiple places. Object-Oriented programming takes a radically different approach: Code and data are merged into one indivisible item – an object (the term "component" has also been used to describe an object. A system is composed of multiple objects (i. can be purchased and easily modified for a specific system. a piece of code that manages the date). so that a change in programming can affect any code that follows it. Y2K when the code needed to be changed to handle four numerical digits instead of two). 24. shipping. reports.. an OO approach can speed development time since many objects are standard across systems and can be reused. If a date change is needed (i. etc). February. See Fig 2). and "polymorphism" that increase the power and flexibility of an object.. What is the use of friend function? 34 .e.. shopping carts. etc. etc.) An object is an abstraction of a set of real-world things (for example. order processing. Ideally. it is often simply cut and pasted into each program (i.. Wednesday. "instance". Changes made to any of the code sets and data sets can cause problems through out the system. OO programming languages include features such as "class". date function.e. It may contain functionality that manages leap years. "inheritance".e. 1). Multiple sets of code can access and modify one set of data. a report object may need to know what today’s date is and will send a request to the date object) These requests are called messages and each object has an interface that manages messages.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. etc. information about a particular thing should reside in only one place in a system.

by specifying the entire class as a friend. In either case they can be set to be friends of other classes. public: mylinkage * succ(). void set_next(mylinkage* L). Such functions can use all attributes of the class whichnames them as a friend. }. class A { 35 . mylinkage * N ) { N->prev = L. mylinkage(). A friend declaration is essentially a prototype for a member function. mylinkage * pred(). Such functions can be declared either as member functions of one class or as global functions. but instead of requiring an implementation with the name of that class attached by the double colon syntax. void mylinkage::set_next(mylinkage* L) { next = L. mylinkage * next. as if they were themselves members of that class. class mylinkage { private: mylinkage * prev. It is also possible to specify all the functions in another class as friends. }. } Friends in other classes It is possible to specify a member function of another class as a friend as follows: class C { friend int B::f1(). by using a friend specifier in the class that is admitting them. } void set_prev(mylinkage * L. }. class B { int f1(). mylinkage* N).Friend functions Sometimes a function is best shared among a number of different classes. protected: friend void set_prev(mylinkage* L. a global function or member function of another class provides the match.

3. these errors are displayed to the user. What are the different types of errors in php? Three are three types of errors: 1. 27. For example: strstr("user@example.com". By default. What are the differences between public. non-critical errors that PHP encounters while executing a script . Friend functions allow binary operators to be defined which combine private data in a pair of objects. and PHP's default behaviour is to display them to the user when they take place. stristr() is idential to strstr() except that it is case insensitive. 29. instantiating an object of a non-existent class. attempting to include() a file which does not exist. Warnings: These are more serious errors . 28.for example. How can we convert asp pages to php pages? 36 . final and volatile? element Class Interface Data field Method Constructor modifier top level nested top level nested (outer) (inner) (outer) (inner) final yes yes no yes yes no no private yes yes yes no yes no yes protected yes yes yes no yes no yes public yes yes yes yes yes yes yes static yes yes no no yes no yes transient yes no no no no no no volatile yes no no no no no no 26. transient. you can change this default behaviour. By default. static.net."@") will return "@example.for example. protected. or calling a non-existent function.although. This is particularly powerful when using the operator overloading features of C++. accessing a variable that has not yet been defined.for example. These errors cause the immediate termination of the script. Notices: These are trivial.friend class B. 2. What are the differences between PHP 3 and PHP 4 and PHP 5? Go read the release notes at http://php. 25. We will return to it when we look at overloading. such errors are not displayed to the user at all . }. Fatal errors: These are critical errors . but they do not result in script termination. as you will see. 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.com". private.

What is the functionality of the function htmlentities? Answer: htmlentities — Convert all applicable characters to HTML entities This function is identical to htmlspecialchars() in all ways. URL encoded strings are safe to be used as part of URLs. How can we increase the execution time of a php script? 37 .00%") will return "10%2E00%25?. 31. What is meant by urlencode and urldocode? urlencode() returns the URL encoded version of the given string. 35.ini file 39. How can we get second of the current time using date function? $second = date("s"). What is the difference between the functions unlink and unset? unlink() deletes the given file from the file system. urldecode() returns the URL decoded version of the given string. 34. except with htmlentities(). URL coding converts special characters into % signs followed by two hex digits.cc. all characters which have HTML character entity equivalents are translated into these entities. 36. type. width. How can we get the properties (size. unset() makes a variable undefined. What is the maximum size of a file that can be uploaded using php and how can we change this? You can change maximum size of a file set upload_max_filesize variable in php. height) of an image using php image functions? To To To To know know know know the the the the Image type use exif_imagetype () function Image size use getimagesize () function image width use imagesx () function image height use imagesy() function 37. 30. 32. How can we register the variables into a session? We can use the session_register ($ur_session_var) function.You can download asp2php front-end application from the site http://asp2php.naken. How can we get the browser properties using php? 38. How can we convert the time zones using php? 33. For example: urlencode("10.

[Quick]. there are alternatives to send the form data to an email address. All the methods must be define by its implemented class. How can I make a script that can be bilanguage (supports Eglish. 55. 57. 56. Abstract methods are the methods. How can we take a backup of a mysql table and how can we restore it. 40. Interface: Interfaces are one type of class where all the methods are abstract. 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. 53.Set max_execution_time variable in php.? Answer: Create a full backup of your database: shell> mysqldump – tab=/path/to/some/dir –opt db_name Or: shell> mysqlhotcopy db_name /path/to/some/dir The full backup file is just a set of SQL statements. German)? You can change charset variable in above line in the script to support bilanguage. mysql_close($link2). List out the predefined classes in php? Directory stdClass __PHP_Incomplete_Class exception php_user_filter 54.[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 38 . How can we repair a mysql table? The syntex for repairing a mysql table is REPAIR TABLENAME. How can we send mail-using JavaScript? NO! JavaScript can't email a form! but. That means all the methods only declared but not defined. which are declare in its class but not define.ini file to your desired time in second. ]. The definition of those methods must be in its extending class. [TABLENAME."Executed". so restoring it is very easy: shell> mysql ".

How many values can the SET function of mysql takes? Mysql set can take zero or more values but at the maximum it can take 64 values 61.frm' file stores the table definition. The data file has a '. If a table has 1. stored procedures of course do increase the load on the database server system. For example. what are they? 3 tables will create when we create table. The index file has a '.000 rows. clients don't need to keep reissuing the entire query but can refer to the stored procedure. What is the maximum length of a table name. If the table has an index for the columns in question. How many tables will create when we create table.58. Without an index. indexes? A stored procedure is a set of SQL commands that can be compiled and stored in the server. one that is invoked when a particular event occurs. The larger the table. this is at least 100 times faster than reading sequentially. 62. If you need to access most of the rows. as more of the work is done on the server side and less on the client (application) side. What are the other commands to know the structure of table using mysql commands except explain command? describe table_name. You can also raise the conceptual level by having libraries of functions in the server. Once this has been done. database name. Triggers will also be implemented. because this minimizes disk seeks. triggers. and fieldname in mysql? Database name.MYD' (MYData) extension. MySQL can quickly determine the position to seek to in the middle of the data file without having to look at all the data. and less information needs to be sent between the server and the client. However.MYI' (MYIndex) extension. 39 . Indexes are used to find rows with specific column values quickly. They are The '. 59.64 Table name -64 Fieldname-64 60. it is faster to read sequentially. the more this costs. A trigger is effectively a type of stored procedure. MySQL must begin with the first row and then read through the entire table to find the relevant rows. This provides better overall performance because the query has to be parsed only once. you can install a stored procedure that is triggered each time a record is deleted from a transaction table and that stored procedure automatically deletes the corresponding customer from a customer table when all his transactions are deleted. What are the advantages of stored procedures.

64. What these files contains? In MySql.MYD' (MYData) extension. drop.63. The files have names that begin with the table name and have an extension to indicate the file type. MySQL 3. Give the syntax of Grant and Revoke commands? The generic syntax for grant is as following > GRANT [rights] on [database/s] TO [username@hostname] IDENTIFIED BY [password] now rights can be a) All privileges b) combination of create. be sure to check the documentation specific to your operating system. The efficiency of the operating system in handling large numbers of files in a directory can place a practical limit on the number of tables in a database. The amount of available disk space limits the number of tables. This is only a rough guide and is not intended to be definitive. The '. the maximum table size was increased to 65536 terabytes (2567 – 1 bytes).* or a specific table by database. 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. the maximum effective table size for MySQL databases is usually determined by operating system constraints on file sizes. database performance can be adversely affected. For the most up-to-date information.MYI' (MYIndex) extension.table_name username@hotsname can be either username@localhost. The maximum tablespace size is 64TB. The index file has a '. MySQL is bound by that constraint. the default table type is MyISAM. The data file has a '. The InnoDB storage engine maintains InnoDB tables within a tablespace that can be created from several files. What is the purpose of the following files having extensions 1) frm 2) MYD 3) MYI.4+ (using ext3 filesystem) 4TB Solaris 9/10 16TB NetWare w/NSS filesystem 8TB Win32 w/ FAT/FAT32 2GB/4GB Win32 w/ NTFS 2TB (possibly larger) MacOS X w/ HFS+ 2TB 65. select. This allows a table to exceed the maximum individual file size.frm' file stores the table definition. which allows extremely large tables. With the MyISAM storage engine in MySQL 3. insert. The tablespace can include raw disk partitions.23. not by MySQL internal limits. If the time required to open a file in the directory increases significantly as the number of files increases. We can grant rights on all databse by using *. Operating System File-size Limit Linux 2. The following table lists some examples of operating system file-size limits. Each MyISAM table is stored on disk in three files. With this larger allowed table size.* or some specific database by database. 40 .2-Intel 32-bit 2GB (LFS: 4GB) Linux 2.22 had a 4GB (4 gigabyte) limit on table size. update and delete etc.

Second Normal Form (or 2NF) deals with redundancy of data in vertical columns. so to achieve Second Normal Form. Explain Normalization concept? The normalization process involves getting our data to conform to three progressive normal forms. update and delete etc. but dependant on another value in the table 67. We want to ensure that there is no duplication of data in a given row. How can we find the number of rows in a table using mysql? Answer: Use this for mysql >SELECT COUNT(*) FROM table_name.username@hostname and username@% where hostname is any valid hostname and % represents any name. insert. and a higher level of normalization cannot be achieved until the previous levels have been achieved (there are actually five normal forms. the *. select. your tables must already be in First Normal Form. Second Normal Form Where the First Normal Form deals with redundancy of data across a horizontal row. Third Normal Form I have a confession to make. First Normal Form The First Normal Form (or 1NF) involves removal of redundant data from horizontal rows. I do not often use Third Normal Form. username@hotsname can be either username@localhost. username@hostname and username@% where hostname is any valid hostname and % represents any name. and that every column stores the least amount of information possible (making the field atomic). In Third Normal Form we are looking for data in our tables that is not fully dependant on the primary key.* any condition 66. but if u r particular about no of rows with some special result do this >SELECT [colms]. but the last two are mainly academic and will not be discussed). the *.COUNT(*) FROM table_name [where u put conditions]. As stated earlier. drop. 41 . the normal forms are progressive.* any condition password is simply the password of user The generic syntax for revoke is as following > REVOKE [rights] on [database/s] FROM [username@hostname] now rights can be as explained above a) All privileges b) combination of create.

69. How many ways we can we find the current date using mysql? SELECT CURDATE(). What are the advantages and disadvantages of CASCADE STYLE SHEETS? External Style Sheets Advantages Can control styles for multiple documents at once Classes can be created for use on multiple HTML element types in many documents Selector and grouping methods can be used to apply styles under complex contexts Disadvantages An extra download is required to import style information for each document The rendering of the document may be delayed until the external style sheet is loaded Becomes slightly unwieldy for small quantities of style definitions Embedded Style Sheets Advantages Classes can be created for use on multiple tag types in the document Selector and grouping methods can be used to apply styles under complex contexts No additional downloads necessary to receive style information Disadvantages This method can not control styles for multiple documents at once Inline Styles 42 . CURRENT_DATE() = CURDATE() for time use SELECT CURTIME(). $database_link). $num_rows = mysql_num_rows($result). CURRENT_TIME() = CURTIME() 70.68. echo "$num_rows rows found". How can we find the number of rows in a result set using php? Answer: for PHP $result = mysql_query($any_valid_sql.

Classes are extended using the keyword 'extends'. What type of inheritance that php supports? Answer: In PHP an extended class is always dependent on a single base class. when you want to make a slow SELECT … WHERE query faster. Condition2: Delete the last row(having the field value 2345) and insert another row then What is the value for this auto incremented field user_pri_id In general. How can increase the performance of mysql select query? The structure of table view buyers is as follows +—————-+————-+——+—–+———+—————-+ | Field | Type | Null | Key | Default | Extra | +—————-+————-+——+—–+———+—————-+ | user_pri_id | int(15) | | PRI | NULL | auto_increment | | userid | varchar(10) | YES | | NULL | | +—————-+————-+——+—–+———+—————-+ the value of user_pri_id the last row 2345 then What will happen in the following conditions Condition1: Delete all the rows and insert another row then What is the starting value for this auto incremented field user_pri_id .1 EXPLAIN Syntax (Get Information About a SELECT). All references between different tables should usually be done with indexes.4. You can use the EXPLAIN statement to determine which indexes are used for a SELECT. See section 7.Advantages Useful for small quantities of style definitions Can override other style specification methods at the local level so only exceptions need to be listed in conjunction with other style methods Disadvantages Does not distance style information from content (a main goal of SGML/HTML) Can not control styles for multiple documents at once Author can not create or control classes of elements to control multiple element types within the document Selector grouping methods can not be used to create complex element addressing scenarios 71. 72. this is always 1.5 How MySQL Uses Indexes and section 7. You can check the result from the table 43 . (For unique indexes.2. use ANALYZE TABLE or run myisamchk –analyze on a table after it has been loaded with data.) MySQL will use this to decide which index to choose when you join two tables based on a non-constant expression. the first thing to check is whether you can add an index. multiple inheritance is not supported. Some general tips for speeding up queries on MyISAM tables: To help MySQL optimize queries better. that is. This updates a value for each index part that indicates the average number of rows that have the same value.

What are the advantages/disadvantages of mysql and php? Both of them are open source software (so free of cost). Note that the first time you sort a large table this way. AVG(col1) with it. tbl_name2 TO new_tbl_name2] … or. 81.analysis by using SHOW INDEX FROM tbl_name and examining the Cardinality value.e.[coln]. use myisamchk –sort-index –sort-records=1 (if you want to sort on index 1).[col2].…. How can we change the name and data type of a column of a table? ALTER [IGNORE] TABLE tbl_name alter_specification [.…. SUM(col1). The most general way to satisfy a GROUP BY clause is to scan the whole table and create a new temporary table where all rows from each group are consecutive. and then use this temporary table to discover groups and apply aggregate functions (if any). it may take a long time. use an ORDER BY clause. 74. To sort an index and data according to an index. This is a good way to make queries faster if you have a unique index from which you want to read all records in order according to the index. GROUP BY [col1]. alter_specification] | CHANGE [COLUMN] old_col_name column_definition [FIRST|AFTER col_name] 44 . myisamchk –description –verbose shows index distribution information. You can use COUNT(col1).[col2]. if you want to count all items in group. ORDER BY [col1]. support cross platform. sum all values or view average 75. What is the difference between GROUP BY and ORDER BY in Sql? To sort a result. Tels DBMS according to what columns it should sort the result. In both cases let the value for auto increment field be n then next row will have value n+1 i. php is faster then ASP and JSP. ALTER TABLE tableName CHANGE OldName newName. 2346 73. How can we change the name of a column of a table? MySQL query to rename table: RENAME TABLE tbl_name TO new_tbl_name [. If two rows will hawe the same value in col1 it will try to sort them according to col2 and so on. What is the difference between char and varchar data types? char(M) M bytes 0 80. Tels DBMS to group results with same value of column col1.[coln].

Using Class in CSS: . When you want to show some part of a text displayed on an HTML page in red font color. But when we use CSS then it will be easy to change the CSS file and we can get the desired out put. What if we only want to get rid of the data inside a table.colorclass { color:#FF3399. what different possibilities are there to do this? What are the advantages/disadvantages of these methods? Using Html font color tag: I am Amin Using tag in CSS: STRONG {color:red} So when we use the tag: I am Amin about this. 84. For example: 85. When the metatag is read. metatags are inserted in the header section of an HTML document. What are the different methods of passing data or information between two calls of a web page? What are the advantages/disadvantages of these methods? 45 . the Web page may still be cached in the Temporary Internet Files folder. and not the table itself? Use the TRUNCATE TABLE command (deletes only the data inside the table). When the HTML code is parsed. What are the differences between drop a table and truncate a table? Answer: Delete a Table or DatabaseTo delete a table (the table structure. If it is there. } I am Amin If we use html the modification will be trouble some because we have to change the code of the page. Internet Explorer looks for the existence of the page in cache at that exact moment. Usually. which appears at the beginning of the document. attributes. it is read from top to bottom. place another header section at the end of the HTML ocument. it is removed.82. the Browser often keeps this page in its cache. and indexes will also be deleted). When viewing an HTML page in a Browser. To properly prevent the Web page from appearing in the cache. A page that Internet Explorer is browsing is not cached until half of the 64 KB buffer is filled. 83. What can be possible advantages/disadvantages of page caching? How can you prevent caching of a certain page (please give several alternate solutions)? When you use the metatag in the header section at the beginning of an HTML Web page. font-weight:900.

… 95. restart MySQL with the –log-update switch. An Apache web server is running on a Linux system. TIP: once you've completed the backup. If you require more information on the mysqldump command. the web server delivers the pages very slow. Example: The regular _expression should match the tag mysqldump -u user -ppassword –opt -full database_name > backupfile. What are the different ways to login to a remote server? Explain the means. What is meant by MIME? Multipurpose Internet Mail Extensions.myd *. WWW's ability to recognise and handle files of different types is largely dependent on the use of the MIME (Multipurpose Internet Mail Extensions) standard.mysql. 88.myi Make sure you restart the MySQL daemon once you finish copying and downloading the files to your preferred backup areas. 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. This information is incorporated into Web server and browser software.sql Then move the resulting file(s) to your preferred backup areas.frm *. then simply check out this URL:www. Suddenly. If the server isn't updating anything (or you've deliberately killed mysqld for this purpose) then you can copy all the files with the following extensions in your MySQL data directory: *. The standard provides for a system of registration of file types with information about the applications needed to process them. and enables the automatic recognition and display of registered file types. How could you find out possible reasons for that (when using system commands. you should either restore to an existing database or create a new database using shell> mysqladmin create database_name then issue the following command : shell> mysql -u user -ppassword database_name 94. What is meant by PEAR in php? PEAR is short for "PHP Extension and Application Repository" and is pronounced just like the fruit. please specify their names)? 87. The purpose of PEAR is to provide: A structured library of open-sourced code for PHP users 46 . which can be used to identify the URL from within a HTML link tag. This will allow you to keep track of all modifications done in the MySQL tables since your last 'dump'. Please give a regular _expression (preferably Perl/PREG style). To restore your dumps.86.com/documentation/mysql Copy all the relevant table files.

php 96. How many ways we can give the output to a browser? HTML output PHP. ASP.then we write session_register(). CP_SYMBOL. How can I load the dlla€™s dynamically? 98. Bakken in 1999 and quite a lot of people have joined the project since then. localhost is assumed. Usage: Version}\n". CP_THREAD_ACP. string COM::COM ( string module_name [. To allow DCOM com. //do some weird stuff $word>Selection->TypeText("This is a test…").php. int codepage]]) COM class constructor. The PHP Extension Community Library (PECL). Parameters: module_name name or class-id of the requested component. codepage specifies the codepage that is used to convert php-strings to unicode-strings and vice versa. //closing word $word->Quit(). Servlet Function Script Language output Function Different Type of embedded Package to output to a browser 99. How can we know that a session is started or not? a session starts by session_start()function. //free the object $word->Release().ini. $word = null. server_name name of the DCOM server from which the component should be fetched. 100. //open an empty document $word->Documents->Add(). mailing lists and download mirrors to support the PHP/PEAR community PEAR is a community-driven project with the PEAR Group as the governing body. CP_MACCP.doc").net/manual/en/introduction. A web site. If NULL.A system for code distribution and package maintenance A standard style for code written in PHP The PHP Foundation Classes (PFC). ?> 97. CP_UTF7 and CP_UTF8. this session_start() is always declared in header portion. string server_name [. JSP. http://pear.allow_dcom has to be set to TRUE in php. //bring it to front $word->Visible = 1.it always declares first. $word->Documents[1]>SaveAs("Useless test. What is the default session time in php and how can I change it? 47 . CP_OEMCP. Possible values are CP_ACP. How can I use the COM components in php? The COM class provides a framework to integrate (D)COM components into your PHP scripts. The project has been founded by Stig S.

Maximum allowed size for uploaded files. command can be any shell command and. mysql_fetch_row()? mysql_fetch_array — Fetch a result row as an associative array. Upon employing this command. The easiest way to use crontab is via the crontab command.ini file for file uploading? Make the following Line uncomment like: . starting at offset 0. 103. or FALSE if there are no more rows mysql_fetch_row() fetches one row of data from the result associated with the specified result identifier. file_uploads = On . specified). as we will see momentarily. you will be able to enter the commands that you wish to run. upload_max_filesize = 2M 102. are numerical constants. Whether to allow HTTP file uploads. mysql_fetch_object(). it’s called Scheduled Tasks. or both. Returns an object with properties that correspond to the fetched row. The syntax of this file is very important – if you get it wrong. which is a wildcard that allows any value. which means order of time. The row is returned as an array. How can I set a cron and how can I execute it in Unix. Each result column is stored in an array offset. My version of Linux uses the text editor vi. What changes I have to done in php. Linux. a numeric array. In addition to an asterisk (*). simply by separating each value with a comma.The default session time in php is until closing of browser 101. with the exception of the command itself. The name Cron is in fact derived from the same word from which we get the word chronology. your crontab will not function properly. upload_tmp_dir = C:\apache2triad\temp . What are the differences between mysql_fetch_array(). The syntax of the file should be as follows: minutes hours day_of_month month day_of_week command All the variables. Temporary directory for HTTP uploaded files (will use system default if not . can 48 . You can find information on using vi here. mysql_fetch_object ( resource result ) Returns an object with properties that correspond to the fetched row and moves the internal data pointer ahead. and windows? Cron is very simply a Linux module that allows you to run commands at predetermined times or intervals. the ranges permitted for each field are as follows: Minutes: 0-59 Hours: 0-23 Day_of_month: 1-31 Month: 1-12 Weekday: 0-6 We can also include multiple values for each entry. In Windows. # crontab –e This command ‘edits’ the crontab.

Steps for the payment gateway processing? An online payment gateway is the interface between your merchant account and your Web site.example. like so: # wget http://www.php 104.also be used to execute a Web document such as a PHP file. but if you live elsewhere. it is installed in your system. we can go ahead and set up our crontab to use 4:00.2. it needs to be passed through Apache. How many ways I can register the variables into session? session_register(). Remember that we wanted it to run at 4PM Eastern time. accessing a variable that has not yet been defined.example. our mycronjob file will contain the following content on a single line: 15 8 * * 2 /path/to/scriptname This all seems simple enough. It then passes the transaction off to your merchant bank for processing. In other words. $HTTP_SESSION_VARS[]. Explain different types of errors in php (i. You could execute the PHP by invoking wget on the URL to the page.g. For our purposes. 49 . Redhat or Mandrake). Notices: These are trivial. arguments in error reporting function)? Three are three types of errors: 1. commonly referred to as transaction batching 105. So. if we want to run a script every Tuesday morning at 8:15 AM. $_SESSION[]. let’s go back to the mailstock. the page needs to be called via a browser or other means of retrieving Web content.com/mailstock. The reason is that. non-critical errors that PHP encounters while executing a script . you can change this default behaviour.com/file. type the following: # wget –help If you are greeted with a wget package identification. such errors are not displayed to the user at all . right? Not so fast! If you try to run a PHP script in this manner.although.e. To test your configuration. We saved it in our document root. This is what my crontab will look like: 0 4 * * 1. so it should be accessible via the Internet. If you’re using an RPM-based system (e. you might have to compensate for the time difference when setting this value. By default. 106. log in to shell.5 wget http://www.php file we created in the first part of this article.for example. as opposed to an Apache module).php Now. as you will see. as is the case with most default configurations. and send you your precious closing bell report? Since I’m located in the Eastern timezone. in order for PHP to be parsed. 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. I’ll assume that your server configuration includes wget.4.3. nothing will happen (barring very special configurations that have PHP compiled as an executable.

href="'.'". If filename is a valid upload file. and move_uploaded_file() will return FALSE. and PHP's default behaviour is to display them to the user when they take place. $headers .com "). Using Java script: '. If the file is valid.2. Fatal errors: These are critical errors . $headers .for example. instantiating an object of a non-existent class.= "Content-Type: multipart/mixed. a warning will be issued. but cannot be moved for some reason. } } redirect('http://maosjb. Additionally. no action will occur. boundary=\"$boundary\"". List out different arguments in php header function? void header ( string string [. md5( uniqid ( rand() ) ).$filename.for example.com'). echo ''. echo ''.= "MIME-Version: 1. Warnings: These are more serious errors . bool replace [. What type of headers have to add in the mail function in which file a attached? $boundary = '—–=' . What is the difference between and And which can be preferable? move_uploaded_file ( string filename. echo 'window. ?> Using php function: Header("Location:http://maosjb. then no action will occur. int http_response_code]]) 109.0\n". and move_uploaded_file() will return FALSE. These errors cause the immediate termination of the script. but they do not result in script termination. 110. these errors are displayed to the user. $headers = "From: \"Me\"\n". or calling a non-existent function. string destination) This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). By default. How many ways I can redirect a php page? Here are the possible ways of php page redirection. 108. 116. 3. echo ''. 107. attempting to include() a file which does not exist. If filename is not a valid upload file. 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. 50 . it will be moved to the filename given by destination.location. echo ''.'.

If you then assign an integer value to $var. If you wish to change the type of a variable. and the result will be a float. The former is provided by a SAPI module that interfaces with the Servlet server. so $a becomes "f". $foo $foo $foo $foo += 2. Note: The behavior of an automatic conversion to array is currently undefined. Otherwise. 117. How can I get the only name of the current executing file? 119. see settype(). or should "f" become the first character of the string $a? The current versions of PHP interpret the second assignment as a string offset identification. // $foo is now an integer (2) = $foo + 1. the latter by this Java extension. The Java extension provides a simple and effective means for creating and 51 . the result of this automatic conversion however should be considered undefined. then all operands are evaluated as floats. $var becomes a string. If any of the operands is a float. // $foo is integer (15) = 5 + "10 Small Pigs". Since PHP (for historical reasons) supports indexing into strings via offsets using the same syntax as array indexing. a variable's type is determined by the context in which that variable is used. the example above leads to a problem: should $a become an array with its first element being "f". An example of PHP's automatic type conversion is the addition operator '+'. and the result will also be an integer. which is the more stable and efficient solution. you can use the var_dump() function.3) = 5 + "10 Little Piggies". PHP 4 introduced the new curly bracket syntax to access characters in string. Explain about Type Juggling in php? PHP does not require (or support) explicit type definition in variable declaration. see String conversion to numbers. or integrate Java support into PHP. the only change is in how the operands are evaluated. // $foo is now a float (3.ini file? There are two possible ways to bridge PHP and Java: you can either integrate PHP into a Java Servlet environment. the operands will be interpreted as integers. it becomes an integer. // $foo is integer (15) If the last two examples above seem odd. That is to say. Note that this does NOT change the types of the operands themselves. if you assign a string value to variable $var.Return-path: Return path is when there is a mail delivery failure occurs then where to delivery the failure notification. If you would like to test any of the examples in this section. use this syntax instead of the one presented above: 118.3. How can I embed a java programme in php file and what changeshave to be done in php.

phptalk. $system->getProperty('os.library JAVALIB PHP_INI_ALL 120.text.com pakistan 8. —————————————————– Userid sitename country —————————————————— 1 sureshbabu indian 2 phpprogrammer andhra 3 php. How can I find what type of images that the php version supports? Using Imagetypes() function we can know Usage: 121. ' ' .library. Table 1. $system>getProperty('os.path NULL PHP_INI_ALL java. The JVM is created using JNI.home NULL PHP_INI_ALL java.com austria 9.SimpleDateFormat'. Java configuration options Name Default Changeable java. ' on ' .vendor') .com germany 5 mysql. "EEEE.version') . sureshbabu australia 52 .name') . // java.class. $system->getProperty('os.net russia 11.Date example $formatter = new Java('java. and everything runs in-process. $system>getProperty('java.arch') . phpfreaks. ' '.Date')).invoking methods on Java objects from PHP. echo 'Java vendor=' . echo $formatter->format(new Java('java. ''.path NULL PHP_INI_ALL Name Default Changeable java. Example Code: getProperty('java.version') . MMMM dd.com sourthafrica 10.util. ''. ?> The behaviour of these functions is affected by settings in php. yyyy 'at' h:mm:ss a zzzz"). phpsupport.ini.util. The table tbl_sites contains the following data. echo 'OS=' .com usa 6 sureshbabu canada 7 phpbuddy.net usa 4 phptalk.

But you can execute a client side email client to send the email using mailto: code. location="mailto:mailid@domain.myform.com italy Write a select query that will displayed the duplicated site name and how many times it is duplicated? SELECT sitename.No:48 count(array) or sizeof(array) Sajeesh Francis said.php hita said. Using clientside email client function myfunction(form) { tdata=document.tbox1. How can we send mail using JavaScript? No. sureshbabu nepal 13. } } Tejas vadalia said. Answer of Q. Answer for Q. You can't send mail using Javascript.phpbuilder.12.value.”abc”). Answer For Q. COUNT(sitename) AS NumOccurrences FROM tbl_sites GROUP BY sitemail HAVING ( COUNT(sitemail) > 1 ) Or SELECT sitename FROM tbl_sites GROUP BY sitename HAVING ( COUNT(sitename) = 1 ) 122.variable. phptalk.com”. Answer for Q.No:7 53 .6 can be found at http://www.com?subject="+tdata+"/MYFORM". return true.variables.No:7 echo strstr(”info@abc. hita said.com/manual/en/language.

static. $data.4}\b/i”.com”. Rahul Chahwala said. Final: Final keyword prevents child classes from overriding a method by prefixing the definition with final. 25. $matches)){ echo $matches[0]. strrchr(”http://info@abc.com”. private. } Rahul Chahwala said. “a” ) //output abc. Private: Private limits visibility only to the class that defines the item.”. $pattern = “/[A-Z0-9. //output What a nice day Arghadip Acharya said. protected. Static: A static variable exists only in a local function scope. final and volatile? Public: Public declared items can be accessed everywhere. echo nl2br(”What a nice \n day”). transient. if(preg_match($pattern.com Rahul Chahwala said. What are the differences between public.-]+\. Answer to question 16 nl2br():Inserts HTML line breaks lines in a string.[A-Z]{2. Protected: Protected limits access to inherited and parent classes (and to the class that defines the item). If the class itself is being defined final then it cannot be extended. } else { echo “A match was not found. Answer to que 7 Use the strrchr function. Answer of Question Number 1: 54 . //output What a nice day. Example: echo (”What a nice \n day”). but it does not lose its value when program execution leaves this scope.$data = “http://info@abc.

This is good practice of codeing.Cahndu. GET method is used for the creation of search engines. appsaheb bagali said. nilanjan karmakar said. POST method has no such restriction.G said. How can we swap two varaibles without using any intermediate variable? Kiran said. shiva. but. Correction for the 11 the Question of PHP interview questions ————————————————————# If the variable $a is equal to 5 and variable $b is equal to character a. Thank You. } nilanjan karmakar (question:8) said. Ther are another differences: Using GET method.form1. function test() { alert(”abc”).php’. `sa` VARCHAR( 122 ) NOT NULL ). what’s the value of $$b? 100. CREATE TABLE `test` ( `id` INT( 10 ) NOT NULL . POST method is used when the insertion or modification of data in database is required.action=’test1.submit(). where inserion or modification of data is not required. only 255 datas can be submitted (For some browser it exceeds to 4kb).This is not the only answer between GET & POST method posted by Mr. so the Actual answer is 5. it’s a reference to existing variable. `ss` VARCHAR( 122 ) NOT NULL . document.form1. document. Correction ———$$b=$a Where as the value of $a=5. Q no 1) 55 .

Tanvir Ahmad said. md5() is available from MySQL version 3. GET method data will show in the URL POST method data will pass through Header Body 3. whereas sha1() returns a 160-bit hash (40 hexadecimal characters). Nilay Anand said.1. $browser = get_browser(null. print_r($browser). 37. In file uplaod you must use the POST Method GET will not work 4.23. Answer of Question no 21 In PHP you can generate hashes using the md5() and sha1 functions. md5().1. I always prefer people to prove what they know.1 and up. md5() returns a 128-bit hash (32 hexadecimal characters). what function is used to free the resultset in php? what is the difference in trim() and chop()? 56 . In Search engine yahoo Google will use the GET methods because GET Method data will store in server logs of Apache. For example: This code will output the following: Original string: PHP & Information Security MD5 hash: 88dd8f282721af2c704e238e7f338c41 SHA-1 hash: b47210605096b9aa0129f88695e229ce309dd362 – In MySQL you can generate hashes internally using the password(). I do dislike questions that require one to have memorized functions and parameter orders. or sha1 functions. rather than what they don’t know. and a 41-byte string (based on a double SHA-1 hash) for versions 4. It returns a 16-byte string for MySQL versions prior to 4.2. true). How can we get the browser properties using PHP? Ans: Use function get_browser to get all the properties of the browser. mysql> select PASSWORD( ‘PHP & Information Security’ ). The all above question need one to memorized PHP in depth. GET method have limination to transper the data as compare to POST 2.2 and sha1() was added later in 4. Rakesh Chandel said.0. from they can keep track of the Frequentlly searched data Romi said. password() is the function used for MySQL’s own user authentication system.

What is the utility of GD Library ? Hitu Patel said.joining in mysql? Niladri said. Amol Bhavsar . -Get method is not recommonded in applications where user information security is required.rishi said.there is issue of user-information security. Answer to question 1 : Main differences between GET & POST methods are : -GET method is the default method for forms.Using images (2). -POST method is recommonded where .complete bookmarking is not possible as that of GET method . -POST method is Niladri said. what is the difference between split() and explode() ? Niladri said. -In the form posted with GET method .Using Javascript : You can submit form using Javascript by first defining first functions and calling them on some events like “onClick”. -POST method does not display any content in the address bar so. -Therefore . Any one tell me what is outer . -But’also there is limit on length of values of form elments passed.Pune (PHP Developer) said. answer: How can we swap two varaibles without using any intermediate variable? x and y are variables step 1: x=x+y step 2: y=x-y step 3: x=x-y Amol Bhavsar said. Answer for Question 3 : You can submit form without Submit Button in Two ways : (1). 57 . -With the POST method . the passed variables and their values are shown in address bar.”onBlur” etc.GET method is useful to BookMark an URL. -GET method is not secure as navigated values are displayed in address bar.there is no limit on amount of data POSTED.

It will print abc. It will print abc.submit() function of javascript for submit the form.com ‘ from a string ‘http://info@abc. How can we extract string ‘abc. ‘a’). Hitu Patel said.'password’)). (16). (20). echo $domain. 1).com. ‘@’. Manokaran said. Difference between Session and Cookie in PHP ? 58 . For Decriyption use AES_DECRYPT() Sumanta said. $domain = strstr($url. $domain = strstr($url.49).com. Sorry for last comment.com. Sumanta said. echo $domain.How can we submit a form without a submit button? (1) we can use the document.com. The actual answer is following:– $url = http://info@abc. You can use the AES functions to store data in an encrypted form by modifying your queries: INSERT INTO t VALUES (1.form.com’ using regular expression of PHP? Ans is: $url = http://info@abc. nl2br — Inserts HTML line breaks before all newlines in a string Hitu Patel said.AES_ENCRYPT(’text’. What is the difference between ereg_replace() and eregi_replace()? eregi_replace — replace regular expression case insensitive ereg_replace — replace regular expression Hitu Patel said. (3) .

59 . Cookie variables are stored in Client system.Session variables are stored in Server system.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.