1 2 3 4 5 6 > >>   Sort: Date

PHP Tutorials
Where to find tutorials on PHP language? I want to know how to learn PHP. Here is a large collection of tutorials to answer many frequently asked questions compiled by FYIcenter.com team about PHP language: Downloading and Installing PHP Installing PHP for Windows Verifying PHP Installation PHP Conf...
2023-12-25, 75625🔥, 2💬

💬 2022-09-24 Franklin: Easy to follow. Thanks

Reading Data from Keyboard in PHP
How To Read Data from Keyboard (Standard Input) in PHP? If you want to read data from the standard input, usually the keyboard, you can use the fopen("php://stdin") function. It creates a special file handle linking to the standard input, and returns the file handle. Once the standard input is opene...
2024-01-16, 13200🔥, 5💬

Reading a File in Binary Mode in PHP
How To Read a File in Binary Mode in PHP? If you have a file that stores binary data, like an executable program or picture file, you need to read the file in binary mode to ensure that none of the data gets modified during the reading process. You need to: Open the file with fopen($fileName, "rb")....
2024-01-04, 11521🔥, 1💬

Adding Values to an Array without Keys in PHP
Can You Add Values to an Array without Keys in PHP? Can You Add Values to an Array with a Key? The answer is yes and no. The answer is yes, because you can add values without specifying any keys. The answer is no, because PHP will add a default integer key for you if you are not specifying a key. PH...
2017-02-03, 10205🔥, 0💬

Passing Arrays by References to Functions in PHP
How To Pass Arrays By References? in PHP? Like normal variables, you can pass an array by reference into a function by taking a reference of the original array, and passing the reference to the function. Here is a PHP script on how to pass array as reference: <?php function shrink($array) { a...
2016-12-18, 10090🔥, 0💬

Looping through an Array without "foreach" in PHP
How To Loop through an Array without Using "foreach" in PHP? PHP offers the following functions to allow you loop through an array without using the "foreach" statement: reset($array) - Moves the array internal pointer to the first value of the array and returns that value. end($array) - Moves the a...
2017-01-05, 6132🔥, 0💬

Getting Minimum/Maximum Value of an Array in PHP
How To Get the Minimum or Maximum Value of an Array in PHP? If you want to get the minimum or maximum value of an array, you can use the min() or max() function. Here is a PHP script on how to use min() and max(): <?php $array = array(5, 7, 6, 2, 1, 3, 4, 2); print("Minimum number: ".min($arr...
2016-12-28, 5630🔥, 0💬

Protecting Special Characters in Query String in PHP
How To Protect Special Characters in Query String in PHP? If you want to include special characters like spaces in the query string, you need to protect them by applying the urlencode() translation function. The script below shows how to use urlencode(): <?php print("<html>"); p...
2022-09-09, 4637🔥, 1💬

Opening Standard Output as a File Handle in PHP
How To Open Standard Output as a File Handle in PHP? If you want to open the standard output as a file handle yourself, you can use the fopen("php://stdout") function. It creates a special file handle linking to the standard output, and returns the file handle. Once the standard output is opened to ...
2016-11-24, 4598🔥, 0💬

Accessing Global Variables inside a Function in PHP
How To Access a Global Variable inside a Function? in PHP? By default, global variables are not accessible inside a function. However, you can make them accessible by declare them as "global" inside a function. Here is a PHP script on declaring "global" variables: <?php ?> $intRate = 5...
2016-12-08, 4474🔥, 0💬

Creating an Array with a Sequence in PHP
How To Create an Array with a Sequence of Integers or Characters in PHP? The quickest way to create an array with a sequence of integers or characters is to use the range() function. It returns an array with values starting with the first integer or character, and ending with the second integer or c...
2023-07-28, 4318🔥, 1💬

Moving Uploaded Files to Permanent Directory in PHP
How To Move Uploaded Files To Permanent Directory in PHP? 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. ...
2016-10-14, 4273🔥, 0💬

Using an Array as a Queue in PHP
How To Use an Array as a Queue in PHP? A queue is a simple data structure that manages data elements following the first-in-first-out rule. You use the following two functions together to use an array as a queue: array_push($array, $value) - Pushes a new value to the end of an array. The value will ...
2017-01-11, 4233🔥, 0💬

Removing Slashes on Submitted Input Values in PHP
How To Remove Slashes on Submitted Input Values in PHP? By default, when input values are submitted to the PHP engine, it will add slashes to protect single quotes and double quotes. You should remove those slashes to get the original values by applying the stripslashes() function. Note that PHP eng...
2022-12-14, 3760🔥, 1💬

💬 2022-12-14 /nme: /data

$_GET, $_POST and $_REQUEST in PHP
Where Is the Submitted Form Data Stored in PHP? When a user submit a form on your Web server, user entered data will be transferred to the PHP engine, which will make the submitted data available to your PHP script for processing in pre-defined arrays: $_GET - An associate array that store form data...
2016-11-15, 3670🔥, 0💬

Splitting a File Path Name into Parts in PHP
How To Break a File Path Name into Parts in PHP? If you have a file name, and want to get different parts of the file name, you can use the pathinfo() function. It breaks the file name into 3 parts: directory name, file base name and file extension; and returns them in an array. Here is a PHP script...
2016-11-17, 3597🔥, 0💬

Issue with "while ($c=fgetc($f))" Loop in PHP
What's Wrong with "while ($c=fgetc($f)) {}" in PHP? If you are using "while ($c=fgetc($f)) {}" to loop through each character in a file, the loop may end in the middle of the file when there is a "0" character, because PHP treats "0" as Boolean false. To properly loop to the end of the file, you sho...
2016-11-27, 3367🔥, 0💬

Using isset($_REQUEST('name')) in PHP
How To Avoid the Undefined Index Error in PHP? If you don't want your PHP page to give out errors as shown in the previous exercise, you should consider checking all expected input fields in $_REQUEST with the isset() function as shown in the example script below: <?php if (isset($_REQUEST['n...
2016-11-15, 3347🔥, 0💬

What Is session_register() in PHP
What Is session_register() in PHP? session_register() is old function that registers global variables into the current session. You should stop using session_register() and use array $_SESSION to save values into the current session now.     ⇒ Working with MySQL Database in PHP ⇐ Closing a Session ...
2016-10-22, 3303🔥, 0💬

Converting Character to ASCII Value in PHP
How To Convert a Character to an ASCII Value? If you want to convert characters to ASCII values, you can use the ord() function, which takes the first character 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(): ...
2016-10-13, 3117🔥, 0💬

Padding an Array with a Given Value in PHP
How To Pad an Array with the Same Value Multiple Times in PHP? 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 ...
2017-01-05, 3108🔥, 0💬

Submitting Values without Using a Form in PHP
How To Submit Values without Using a Form in PHP? If you know the values you want to submit, you can code the values in a hyper link at the end of the URL. The additional values provided at the end of a URL is called query string. There are two suggestions on how to use query strings to submit value...
2016-11-08, 3038🔥, 0💬

Reading the Entire File to a String in PHP
How To Read the Entire File into a Single String in PHP? If you have a file, and you want to read the entire file into a single string, you can use the file_get_contents() function. It opens the specified file, reads all characters in the file, and returns them in a single string. Here is a PHP scri...
2016-12-04, 3024🔥, 0💬

Setting session.gc_divisor Properly in PHP
How To Set session.gc_divisor Properly in PHP? As you know that session.gc_divisor is the frequency of when the session garbage collection process will be executed. You should set this value based on the income request traffic. Here are some suggestions: # Set it to 10, if traffic is less than 10,00...
2016-10-24, 2929🔥, 0💬

1 2 3 4 5 6 > >>   Sort: Date