InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
Can You Define An Argument As A Reference Type? |
|
Answer» You can define an argument as a reference type in the FUNCTION definition. This will AUTOMATICALLY CONVERT the calling arguments into references. Here is a PHP script on how to define an argument as a reference type: You can define an argument as a reference type in the function definition. This will automatically convert the calling arguments into references. Here is a PHP script on how to define an argument as a reference type: |
|
| 52. |
How To Pass Variables By References? |
|
Answer» You can pass a VARIABLE by reference to a function by taking the reference of the original variable, and passing that reference as the calling argument. Here is a PHP SCRIPT on how to use pass variables by references: You can pass a variable by reference to a function by taking the reference of the original variable, and passing that reference as the calling argument. Here is a PHP script on how to use pass variables by references: |
|
| 53. |
How Variables Are Passed Through Arguments? |
|
Answer» Like more of other programming languages, VARIABLES are PASSED through arguments by values, not by references. That means when a variable is passed as an argument, a copy of the value will be passed into the function. Modipickzyng that copy INSIDE the function will not impact the original copy. Here is a PHP script on passing variables by values: Like more of other programming languages, variables are passed through arguments by values, not by references. That means when a variable is passed as an argument, a copy of the value will be passed into the function. Modipickzyng that copy inside the function will not impact the original copy. Here is a PHP script on passing variables by values: |
|
| 54. |
How To Pass An Argument To A Function? |
|
Answer» To pass an argument to a function, you need to: To pass an argument to a function, you need to: |
|
| 55. |
How To Return A Value Back To The Function Caller? |
|
Answer» You can return a VALUE to the function caller by USING the "return $value" statement. Execution control will be TRANSFERRED to the caller immediately after the return statement. If there are other statements in the function after the return statement, they will not be executed. Here is a PHP script example on how to return values: You can return a value to the function caller by using the "return $value" statement. Execution control will be transferred to the caller immediately after the return statement. If there are other statements in the function after the return statement, they will not be executed. Here is a PHP script example on how to return values: |
|
| 56. |
How To Invoke A User Function? |
|
Answer» You can invoke a function by entering the function name FOLLOWED by a pair of parentheses. If NEEDED, function arguments can be specified as a LIST of expressions enclosed in parentheses. Here is a PHP script example on how to invoke a user function: You can invoke a function by entering the function name followed by a pair of parentheses. If needed, function arguments can be specified as a list of expressions enclosed in parentheses. Here is a PHP script example on how to invoke a user function: |
|
| 57. |
How To Define A User Function? |
|
Answer» You can DEFINE a user function ANYWHERE in a PHP SCRIPT using the function statement like this: "function name() {...}". Here is a PHP script EXAMPLE on how to define a user function: You can define a user function anywhere in a PHP script using the function statement like this: "function name() {...}". Here is a PHP script example on how to define a user function: |
|
| 58. |
How To Join Multiple Strings Stored In An Array Into A Single String? |
|
Answer» If you multiple strings stored in an array, you can join them together into a single STRING with a given delimiter by USING the implode() function. Here is a PHP script on how to use implode(): If you multiple strings stored in an array, you can join them together into a single string with a given delimiter by using the implode() function. Here is a PHP script on how to use implode(): |
|
| 59. |
How To Pad An Array With The Same Value Multiple Times? |
|
Answer» If you want to add the same value multiple times to the end or beginning of an array, you can use the array_pad($array, $new_size, $value) FUNCTION. If the second argument, $new_size, is POSITIVE, it will pad to the end of the array. If negative, it will pad to the beginning of the array. If the absolute value of $new_size if not greater than the current size of the array, no PADDING takes place. Here is a PHP script on how to use array_pad(): If you want to add the same value multiple times to the end or beginning of an array, you can use the array_pad($array, $new_size, $value) function. If the second argument, $new_size, is positive, it will pad to the end of the array. If negative, it will pad to the beginning of the array. If the absolute value of $new_size if not greater than the current size of the array, no padding takes place. Here is a PHP script on how to use array_pad(): |
|
| 60. |
How To Randomly Retrieve A Value From An Array? |
|
Answer» If you have a list of favorite GREETING MESSAGES, and want to randomly select one of them to be used in an email, you can use the array_rand() function. Here is a PHP example script: If you have a list of favorite greeting messages, and want to randomly select one of them to be used in an email, you can use the array_rand() function. Here is a PHP example script: |
|
| 61. |
How To Merge Values Of Two Arrays Into A Single Array? |
|
Answer» You can use the array_merge() function to merge two arrays into a SINGLE array. You can use the array_merge() function to merge two arrays into a single array. |
|
| 62. |
How To Find A Specific Value In An Array? |
|
Answer» There are two FUNCTIONS can be USED to TEST if a value is defined in an ARRAY or not:
Here is a PHP script on how to use arrary_search(): <?php $array = array("Perl", "PHP", "Java", "PHP"); PRINT("Search 1: ".array_search("PHP",$array)."n"); print("Search 2: ".array_search("Perl",$array)."n"); print("Search 3: ".array_search("C#",$array)."n"); print("n"); ?>This script will print: Search 1: 1 There are two functions can be used to test if a value is defined in an array or not: Here is a PHP script on how to use arrary_search(): This script will print: Search 1: 1 |
|
| 63. |
How To Get The Total Number Of Values In An Array? |
|
Answer» You can get the total number of values in an array by using the count() function. Here is a PHP example SCRIPT: You can get the total number of values in an array by using the count() function. Here is a PHP example script: |
|
| 64. |
How The Values Are Ordered In An Array? |
|
Answer» PHP says that an array is an ORDERED map. But how the VALUES are ordered in an array? PHP says that an array is an ordered map. But how the values are ordered in an array? |
|
| 65. |
How Values In Arrays Are Indexed? |
|
Answer» VALUES in an array are all INDEXED their corresponding keys. Because we can use either an integer or a string as a key in an array, we can divide ARRAYS into 3 categories:
Values in an array are all indexed their corresponding keys. Because we can use either an integer or a string as a key in an array, we can divide arrays into 3 categories: |
|
| 66. |
How To Retrieve Values Out Of An Array? |
|
Answer» You can retrieve values out of ARRAYS using the array element expression $array[$key]. You can retrieve values out of arrays using the array element expression $array[$key]. |
|
| 67. |
How To Test If A Variable Is An Array? |
|
Answer» Testing if a variable is an array is easy. Just use the is_array() function. Here is a PHP script on how to use is_array(): Testing if a variable is an array is easy. Just use the is_array() function. Here is a PHP script on how to use is_array(): |
|
| 68. |
What Is An Array In Php? |
|
Answer» An array in PHP is really an ordered map of PAIRS of keys and VALUES. An array in PHP is really an ordered map of pairs of keys and values. |
|
| 69. |
How To Join Multiple Strings Into A Single String? |
|
Answer» If you multiple strings stored in an array, you can join them TOGETHER into a SINGLE string with a given delimiter by using the implode() function. Here is a PHP script on how to USE implode(): If you multiple strings stored in an array, you can join them together into a single string with a given delimiter by using the implode() function. Here is a PHP script on how to use implode(): |
|
| 70. |
How To Convert A Character To An Ascii Value? |
|
Answer» If you want to convert characters to ASCII values, you can USE the ORD() function, which takes the first charcter of the specified string, and returns its ASCII value in DECIMAL format. ord() COMPLEMENTS chr(). Here is a PHP script on how to use ord(): If you want to convert characters to ASCII values, you can use the ord() function, which takes the first charcter of the specified string, and returns its ASCII value in decimal format. ord() complements chr(). Here is a PHP script on how to use ord(): |
|
| 71. |
How To Generate A Character From An Ascii Value? |
|
Answer» If you want to generate characters from ASCII values, you can USE the chr() function. If you want to generate characters from ASCII values, you can use the chr() function. |
|
| 72. |
How To Convert Strings In Hex Format? |
|
Answer» If you want convert a STRING into hex FORMAT, you can use the bin2hex() function. Here is a PHP script on how to use bin2hex(): If you want convert a string into hex format, you can use the bin2hex() function. Here is a PHP script on how to use bin2hex(): |
|
| 73. |
How To Convert The First Character To Upper Case? |
|
Answer» If you are processing an ARTICLE, you may WANT to capitalize the first CHARACTER of a SENTENCE by using the ucfirst() FUNCTION. You may also want to capitalize the first character of every words for the article title by using the ucwords() function. Here is a PHP script on how to use ucfirst() and ucwords(): If you are processing an article, you may want to capitalize the first character of a sentence by using the ucfirst() function. You may also want to capitalize the first character of every words for the article title by using the ucwords() function. Here is a PHP script on how to use ucfirst() and ucwords(): |
|
| 74. |
How To Convert Strings To Upper Or Lower Cases? |
|
Answer» Converting strings to upper or lower CASES are easy. Just use STRTOUPPER() or strtolower() functions. Here is a PHP script on how to use them: Converting strings to upper or lower cases are easy. Just use strtoupper() or strtolower() functions. Here is a PHP script on how to use them: |
|
| 75. |
How To Replace A Substring In A Given String? |
|
Answer» If you know the POSITION of a substring in a given string, you can replace that substring by another string by using the substr_replace() function. Here is a PHP script on how to use substr_replace(): If you know the position of a substring in a given string, you can replace that substring by another string by using the substr_replace() function. Here is a PHP script on how to use substr_replace(): |
|
| 76. |
How To Take A Substring From A Given String? |
|
Answer» If you know the position of a substring in a given STRING, you can take the substring out by the substr() function. Here is a PHP script on how to USE substr(): If you know the position of a substring in a given string, you can take the substring out by the substr() function. Here is a PHP script on how to use substr(): |
|
| 77. |
How To Remove Leading And Trailing Spaces From User Input Values? |
|
Answer» If you are taking input values from users with a Web form, users may enter extra SPACES at the BEGINNING and/or the END of the input values. You should always use the trim() function to remove those extra spaces as shown in this PHP script: If you are taking input values from users with a Web form, users may enter extra spaces at the beginning and/or the end of the input values. You should always use the trim() function to remove those extra spaces as shown in this PHP script: |
|
| 78. |
How To Remove The New Line Character From The End Of A Text Line? |
|
Answer» If you are using fgets() to read a line from a TEXT file, you MAY want to use the CHOP() function to remove the new line character from the end of the line as shown in this PHP script: If you are using fgets() to read a line from a text file, you may want to use the chop() function to remove the new line character from the end of the line as shown in this PHP script: |
|
| 79. |
How To Get The Number Of Characters In A String? |
|
Answer» You can use the "strlen()" FUNCTION to get the NUMBER of characters in a string. Here is a PHP SCRIPT EXAMPLE of strlen(): You can use the "strlen()" function to get the number of characters in a string. Here is a PHP script example of strlen(): |
|
| 80. |
How To Assigning A New Character In A String? |
|
Answer» The string element expression, $string{index}, can also be USED at the LEFT side of an assignment statement. This allows you to assign a NEW character to any position in a string. Here is a PHP script example: The string element expression, $string{index}, can also be used at the left side of an assignment statement. This allows you to assign a new character to any position in a string. Here is a PHP script example: |
|
| 81. |
How To Access A Specific Character In A String? |
|
Answer» Any character in a string can be accessed by a special string element expression: Any character in a string can be accessed by a special string element expression: |
|
| 82. |
How To Include Variables In Double-quoted Strings? |
|
Answer» Variables INCLUDED in double-quoted strings will be interpolated. Their values will be concatenated into the ENCLOSING strings. For example, two statements in the following PHP script will print out the same string: Variables included in double-quoted strings will be interpolated. Their values will be concatenated into the enclosing strings. For example, two statements in the following PHP script will print out the same string: |
|
| 83. |
How Many Escape Sequences Are Recognized In Double-quoted Strings? |
|
Answer» There are 12 escape SEQUENCES you can use in DOUBLE-quoted strings: There are 12 escape sequences you can use in double-quoted strings: |
|
| 84. |
What Are The Special Characters You Need To Escape In Double-quoted Stings? |
|
Answer» There are two SPECIAL characters you need to escape in a DOUBLE-quote string: the double quote (") and the back slash (\). Here is a PHP script EXAMPLE of double-quoted strings: There are two special characters you need to escape in a double-quote string: the double quote (") and the back slash (\). Here is a PHP script example of double-quoted strings: |
|
| 85. |
How Many Escape Sequences Are Recognized In Single-quoted Strings? |
|
Answer» There are 2 ESCAPE sequences you can use in SINGLE-quoted strings: There are 2 escape sequences you can use in single-quoted strings: |
|
| 86. |
How To Process The Uploaded Files? |
|
Answer» How to process the uploaded FILES? The ANSWER is really depending on your application. For example:
How to process the uploaded files? The answer is really depending on your application. For example: |
|
| 87. |
How To Move Uploaded Files To Permanent Directory? |
|
Answer» PHP stores uploaded files in a temporary directory with temporary file NAMES. You must move uploaded files to a permanent directory, if you want to keep them permanently. PHP offers the move_uploaded_file() to help you moving uploaded files. The EXAMPLE script, processing_ uploaded_files.php, below shows a good example: <?php NOTE that you need to change the permanent directory, "\pickzycenter\images\", used in this script to something else on your Web server. If your Web server is provided by a Web hosting company, you may need to ask them which DIRECTORIES you can use to store files. If you copy both scripts, logo_upload.php and processing_uploaded_files.php, to your Web server, you can try them to upload an image file to your Web server. PHP stores uploaded files in a temporary directory with temporary file names. You must move uploaded files to a permanent directory, if you want to keep them permanently. PHP offers the move_uploaded_file() to help you moving uploaded files. The example script, processing_ uploaded_files.php, below shows a good example: <?php Note that you need to change the permanent directory, "\pickzycenter\images\", used in this script to something else on your Web server. If your Web server is provided by a Web hosting company, you may need to ask them which directories you can use to store files. If you copy both scripts, logo_upload.php and processing_uploaded_files.php, to your Web server, you can try them to upload an image file to your Web server. |
|
| 88. |
Why Do You Need To Filter Out Empty Files? |
|
Answer» When you are processing uploaded FILES, you need to check for empty files, because they COULD be resulted from a bad upload process but the PHP engine could still give no error. For example, if a USER typed a bad file name in the upload field and submitted the form, the PHP engine will take it as an empty file without raising any error. The script below shows you an improved logic to process uploaded files: <?php When you are processing uploaded files, you need to check for empty files, because they could be resulted from a bad upload process but the PHP engine could still give no error. For example, if a user typed a bad file name in the upload field and submitted the form, the PHP engine will take it as an empty file without raising any error. The script below shows you an improved logic to process uploaded files: <?php |
|
| 89. |
How To Create A Table To Store Files? |
|
Answer» If you USING MySQL database and WANT to store files in database, you need to create BLOB columns, which can holds up to 65,535 characters. Here is a sample script that creates a table with a BLOB column to be used to store uploaded files: If you using MySQL database and want to store files in database, you need to create BLOB columns, which can holds up to 65,535 characters. Here is a sample script that creates a table with a BLOB column to be used to store uploaded files: |
|
| 90. |
How To Uploaded Files To A Table? |
|
Answer» To store uploaded files to MySQL database, you can USE the normal SELECT statement as shown in the modified processing_uploaded_files.php listed below: To store uploaded files to MySQL database, you can use the normal SELECT statement as shown in the modified processing_uploaded_files.php listed below: |
|
| 91. |
What Are The File Upload Settings In Configuration File? |
|
Answer» There are several settings in the PHP configuration file related to file UPLOADING: There are several settings in the PHP configuration file related to file uploading: |
|
| 92. |
What Are The Advantages/disadvantages Of Mysql And Php? |
|
Answer» Both of them are OPEN SOURCE SOFTWARE (so free of cost), support cross platform. php is faster then ASP and ISP. Both of them are open source software (so free of cost), support cross platform. php is faster then ASP and iSP. |
|
| 93. |
What Is 'float' Property In Css? |
|
Answer» The float property SETS where an IMAGE or a TEXT will appear in another ELEMENT. The float property sets where an image or a text will appear in another element. |
|
| 94. |
Are Namespaces Are There In Javascript? |
|
Answer» A namespace is a container and ALLOWS you to bundle up all your FUNCTIONALITY USING a unique name. In JavaScript, a namespace is really just an object that you’ve attached all further methods, properties and objects. But it is not always NECESSARY to use namespace. A namespace is a container and allows you to bundle up all your functionality using a unique name. In JavaScript, a namespace is really just an object that you’ve attached all further methods, properties and objects. But it is not always necessary to use namespace. |
|
| 95. |
Which Method Do You Follow To Get A Record From A Million Records? (searching Not From Database, From An Array In Php)? |
|
Answer» USE array_searchfl, array_keys, arrayyalues, array_key_exists, and in_array. use array_searchfl, array_keys, arrayyalues, array_key_exists, and in_array. |
|
| 96. |
Who Is The Father Of Php And Explain The Changes In Php Versions? |
|
Answer» Rasmus Lerdorf is known as the father of PHP.PHP/F1 2.0 is an early and no longer supported VERSION of PHP. PHP 3 is the successor to PHP/FI 2.0 and is a lot NICER. PHP 4 is the current generation of PHP, which uses the ZEND engine under the HOOD. PHP 5 uses Zend engine 2 which, among other things, offers many additionalOOP features . Rasmus Lerdorf is known as the father of PHP.PHP/F1 2.0 is an early and no longer supported version of PHP. PHP 3 is the successor to PHP/FI 2.0 and is a lot nicer. PHP 4 is the current generation of PHP, which uses the Zend engine under the hood. PHP 5 uses Zend engine 2 which, among other things, offers many additionalOOP features . |
|
| 97. |
What Is The Difference Between Group By And Order By In Sql? |
|
Answer» To sort a result, use an ORDER BY clause. GROUP BY [col1],[col2],...[coln]; Tells DBMS to group (aggregate) RESULTS with same value of column col1. You can use COUNT(col1), SUM(col1), AVG(col1) with it, if you want to count all items in group, sum all VALUES or view AVERAGE. To sort a result, use an ORDER BY clause. GROUP BY [col1],[col2],...[coln]; Tells DBMS to group (aggregate) results with same value of column col1. You can use COUNT(col1), SUM(col1), AVG(col1) with it, if you want to count all items in group, sum all values or view average. |
|
| 98. |
What Is Meant By Mime? |
|
Answer» MIME is MULTIPURPOSE Internet Mail Extensions is an Internet standard for the format of e-mail. However browsers also USES MIME standard to transmit FILES. MIME has a header which is added to a beginning of the data. When browser sees such header it shows the data as it would be a file (for EXAMPLE image) Some examples of MIME TYPES: audio/x-ms-wmp MIME is Multipurpose Internet Mail Extensions is an Internet standard for the format of e-mail. However browsers also uses MIME standard to transmit files. MIME has a header which is added to a beginning of the data. When browser sees such header it shows the data as it would be a file (for example image) Some examples of MIME types: audio/x-ms-wmp |
|
| 99. |
What Are The Different Ways To Login To A Remote Server? Explain The Means, Advantages And Disadvantages? |
|
Answer» There is at least 3 ways to logon to a REMOTE SERVER: There is at least 3 ways to logon to a remote server: |
|
| 100. |
Steps For The Payment Gateway Processing? |
|
Answer» An online PAYMENT gateway is the interface between your merchant account and your Web site. The online payment gateway ALLOWS you to immediately verify credit card transactions and authorize funds on a customer’s credit card DIRECTLY from your Web site. It then passes the TRANSACTION off to your merchant bank for processing, commonly referred to as transaction BATCHING. An online payment gateway is the interface between your merchant account and your Web site. The online payment gateway allows you to immediately verify credit card transactions and authorize funds on a customer’s credit card directly from your Web site. It then passes the transaction off to your merchant bank for processing, commonly referred to as transaction batching. |
|