<< < 1 2 3 4 5 6 7 8 9 10 > >>   Sort: Date

Including Variables in Double-Quoted Strings in PHP
How To Include Variables in Double-Quoted Strings? 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: &lt;?php $variable = "and"; e...
2016-10-13, 1616🔥, 0💬

What Is File Upload in PHP
What Is File Upload in PHP? File upload is Web page function which allows visitor to specify a file on the browser's system and submit it to the Web server. This is a very useful function for many interactive Web sites. Some examples are: Web base email systems for users to send attachments. Forums ...
2016-10-17, 1615🔥, 0💬

Passing Variables by References in PHP
How To Pass Variables By References? in PHP? 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: &lt;?php function swap($a, $b) { ...
2016-12-24, 1610🔥, 0💬

Uploading Files to Web Servers in PHP
Where to find tutorials on how to upload files to Web servers in PHP? A collection of tutorials to answer many frequently asked questions on how to upload files to Web servers in PHP. Clear explanations and tutorial exercises are provided on creating file upload HTML tags, setting encoding type on H...
2016-10-17, 1606🔥, 0💬

Retrieving Directory Name from File Path Name in PHP
How To Get the Directory Name out of a File Path Name in PHP? If you have the full path name of a file, and want to get the directory name portion of the path name, you can use the dirname() function. It breaks the full path name at the last directory path delimiter (/) or (\), and returns the first...
2016-11-20, 1599🔥, 0💬

Creating an Array in PHP
How To Create an Array in PHP? You can create an array using the array() constructor. When calling array(), you can also initialize the array with pairs of keys and values. Here is a PHP script on how to use array(): &lt;?php print("Empty array:\n"); $emptyArray = array(); print_r($emptyArray); ...
2016-10-15, 1599🔥, 0💬

Taking a Substring in PHP
How To Take a Substring from a Given String? 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(): &lt;?php $string = "beginning"; print("Position counted from left: ".substr($string,0,5)."...
2016-10-13, 1597🔥, 0💬

Understanding and Using Sessions in PHP
Where to find tutorials on how to use Sessions in PHP? A collection of tutorials to answer many frequently asked questions on how to use Sessions in PHP. Clear explanations and tutorial exercises are provided on starting and closing sessions, saving and retrieving values in sessions, deciding how se...
2016-10-29, 1594🔥, 0💬

Splitting a String in PHP
How To Split a String into Pieces? There are two functions you can use to split a string into pieces: explode(substring, string) - Splitting a string based on a substring. Faster than split(). split(pattern, string) - Splitting a string based on a regular expression pattern. Better than explode() in...
2016-10-13, 1594🔥, 0💬

Looping through an Array in PHP
How to Loop through an Array in PHP? The best way to loop through an array is to use the "foreach" statement. There are two forms of "foreach" statements: foreach ($array as $value) {} - This gives you only one temporary variable to hold the current value in the array. foreach ($array as $key=&g...
2017-02-03, 1593🔥, 0💬

Supporting Multiple Submit Buttons in PHP
How To Support Multiple Submit Buttons in PHP? Sometimes, you may need to give visitors multiple submit buttons on a single form to allow them to submit the form for different purposes. For example, when you show your customer a purchase order in a Web form, you may give your customer 3 submit butto...
2016-11-08, 1593🔥, 0💬

Assigning a New Character in a String in PHP
How To Assigning a New Character in a String? 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: &lt;?php $string = 'It\'s Friday?'; echo...
2016-10-13, 1592🔥, 0💬

Number of Cookies Supported in PHP
How Many Cookies Can You Set in PHP? How many cookies can you set in your PHP page? The answer is depending what is the Web browser your visitor is using. Each browser has its own limit: Internet Explorer (IE): 20 Mozilla Firefox: 50 If you want to test this limit, copy this sample script, how_many_...
2016-10-30, 1590🔥, 0💬

Converting Strings to Numbers in PHP
How To Convert Strings to Numbers? In a numeric context, PHP will automatically convert any string to a numeric value. Strings will be converted into two types of numeric values, double floating number and integer, based on the following rules: The value is given by the initial portion of the string...
2016-10-13, 1587🔥, 0💬

Testing Cookies on a Web Server in PHP
How To Test Cookies on a Web Server in PHP? If you want to test cookies with a browser, you need to run a Web server locally, or have access to a Web server remotely. Then you can copy the following PHP cookie test page, setting_receiving_cookies.php, to the Web server: &lt;?php setcookie("Login...
2016-11-04, 1586🔥, 0💬

Installing MySQL Server in PHP
How To Install MySQL Server in PHP? MySQL is an open source database management system developed by MySQL AB, http://www.mysql.com. You can download a copy and install it on your local computer. Here is how you can do this: Go to http://dev.mysql.com/downloads /mysql/5.0.html.Select the "Windows" an...
2016-10-22, 1583🔥, 0💬

Retrieving All Keys from an Array in PHP
How To Get All the Keys Out of an Array in PHP? Function array_keys() returns a new array that contains all the keys of a given array. Here is a PHP script on how to use array_keys(): &lt;?php $mixed = array(); $mixed["Zero"] = "PHP"; $mixed[1] = "Perl"; $mixed["Two"] = "Java"; $mixed["3"] = "C+...
2017-01-21, 1582🔥, 0💬

Saving Values in the Session in PHP
How To Save Values to the Current Session in PHP? When session is turned on, a session will be automatically created for you by the PHP engine. If you want to save any values to the session, you can use the pre-defined associative array called $_SESSION. The following PHP script shows you how to sav...
2023-12-25, 1577🔥, 1💬

Appending Data to the End of a File in PHP
How To Append New Data to the End of a File in PHP? If you have an existing file, and want to write more data to the end of the file, you can use the fopen($fileName, "a") function. It opens the specified file, moves the file pointer to the end of the file, and returns a file handle. The second argu...
2016-12-02, 1576🔥, 0💬

Concatenating Two Strings in PHP
How To Concatenate Two Strings Together? You can use the string concatenation operator (.) to join two strings into one. Here is a PHP script example of string concatenation: &lt;?php echo 'Hello ' . "world!\n"; ?&gt; This script will print: Hello world!     ⇒ Comparing Two Strings in PHP ⇐...
2016-10-13, 1575🔥, 0💬

Returning a Value from a Function in PHP
How To Return a Value Back to the Function Caller? in PHP? 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 ...
2016-12-24, 1571🔥, 0💬

Mistake on Setting Cookie Path and Domain in PHP
What Is the Common Mistake When Setting Path and Domain on Temporary Cookies in PHP? A common mistake made by many PHP developers is using an empty string for the expiration time parameter when setting path and domain for temporary cookies. The PHP script below shows an example of this mistake: &...
2016-11-03, 1566🔥, 0💬

Turning on the Session Support in PHP
How To Turn on the Session Support in PHP? The session support can be turned on automatically at the site level, or manually in each PHP page script: Turning on session support automatically at the site level: Set session.auto_start = 1 in php.ini. Turning on session support manually in each page sc...
2016-10-29, 1562🔥, 0💬

Testing the Session Garbage Collection Process in PHP
How To Test the Session Garbage Collection Process in PHP? In order to test the session garbage collection process, you need to change the settings to expire session variables in 10 seconds and run the process on every request: session.gc_probability = 1 session.gc_divisor = 1 session.gc_maxlifetime...
2016-10-24, 1562🔥, 0💬

<< < 1 2 3 4 5 6 7 8 9 10 > >>   Sort: Date