• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

PHP Interview Questions Answers

Question - 51 : - What is the difference between the functions unlink and unset?

Answer - 51 : - unlink() is a function for file system handling. It will simply delete the file in context. unset() is a function for variable management. It will make a variable undefined.

Question - 52 : - What changes I have to do in php.ini file for file uploading?

Answer - 52 : - Make the following line uncomment like: ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). upload_tmp_dir = C:\apache2triad\temp ; Maximum allowed size for uploaded files. upload_max_filesize = 2M

Question - 53 : - How To Get the Uploaded File Information in the Receiving Script?

Answer - 53 : - Once the Web server received the uploaded file, it will call the PHP script specified in the form action attribute to process them. This receiving PHP script can get the uploaded file information through the predefined array called $_FILES. Uploaded file information is organized in $_FILES as a two-dimensional array as: $_FILES[$fieldName]['name'] - The Original file name on the browser system. $_FILES[$fieldName]['type'] - The file type determined by the browser. $_FILES[$fieldName]['size'] - The Number of bytes of the file content. $_FILES[$fieldName]['tmp_name'] - The temporary filename of the file in which the uploaded file was stored on the server. $_FILES[$fieldName]['error'] - The error code associated with this file upload. The $fieldName is the name used in the <INPUT TYPE=FILE, NAME=fieldName>.

Question - 54 : - Would I use print "$a dollars" or "{$a} dollars" to print out the amount of dollars in this example?

Answer - 54 : - In this example it wouldn’t matter, since the variable is all by itself, but if you were to print something like "{$a},000,000 mln dollars", then you definitely need to use the braces.

Question - 55 : - How can increase the performance of MySQL select query?

Answer - 55 : - We can use LIMIT to stop MySql for further search in table after we have received our required no. of records, also we can use LEFT JOIN or RIGHT JOIN instead of full join in cases we have related data in two or more tables.

Question - 56 : - What is the difference between $message and $$message?

Answer - 56 : - 1) - $message is a simple variable whereas $$message is a reference variable. Example: $user = 'bob' is equivalent to $holder = 'user'; $$holder = 'bob'; 2) - They are both variables. But $message is a variable with a fixed name. $$message is a variable who's name is stored in $message. For example, if $message contains "var", $$message is the same as $var.

Question - 57 : - How many ways we can we find the current date using MySQL?

Answer - 57 : - SELECT CURDATE(); SELECT CURRENT_DATE(); SELECT CURTIME(); SELECT CURRENT_TIME();

Question - 58 : - How can I know that a variable is a number or not using a JavaScript?

Answer - 58 : - 1) - bool is_numeric( mixed var) Returns TRUE if var is a number or a numeric string, FALSE otherwise. 2)- Definition and Usage The isNaN() function is used to check if a value is not a number. Syntax isNaN(number) Parameter Description number Required. The value to be tested

Question - 59 : - How can I use the COM components in php?

Answer - 59 : - The COM class provides a framework to integrate (D)COM components into your PHP scripts. string COM::COM( string module_name [, string server_name [, int codepage]]) - COM class constructor. Parameters: module_name: name or class-id of the requested component. server_name: name of the DCOM server from which the component should be fetched. If NULL, localhost is assumed. To allow DCOM com, allow_dcom has to be set to TRUE in php.ini. codepage - specifies the codepage that is used to convert php-strings to unicode-strings and vice versa. Possible values are CP_ACP, CP_MACCP, CP_OEMCP, CP_SYMBOL, CP_THREAD_ACP, CP_UTF7 and CP_UTF8. Usage: $word->Visible = 1; //open an empty document $word->Documents->Add(); //do some weird stuff $word->Selection->TypeText("This is a test…"); $word->Documents[1]->SaveAs("Useless test.doc"); //closing word $word->Quit(); //free the object $word->Release(); $word = null;

Question - 60 : - How many ways we can retrieve the date in result set of mysql using php?

Answer - 60 : - As individual objects so single record or as a set or arrays.

Computer Contributors

krishan
Rajeev Katiyar
Yes Baroda

Share your email for latest updates

Name:
Email:

Our partners