1 2 3 4 5 6 > >>   ∑:217  Sort:Rank

Reformatting a Paragraph of Text in PHP
How To Reformat a Paragraph of Text? You can wordwrap() reformat a paragraph of text by wrapping lines with a fixed length. Here is a PHP script on how to use wordwrap(): <?php $string = "TRADING ON MARGIN POSES ADDITIONAL RISKS AND IS NOT SUITABLE FOR ALL INVESTORS. A COMPLETE LIST OF THE RI...
2024-02-27, ∼2019🔥, 5💬

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, ≈14🔥, 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, ≈12🔥, 1💬

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, ∼1764🔥, 1💬

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, ≈89🔥, 2💬

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

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, ∼4867🔥, 1💬

Passing Arrays to Function in PHP
Can You Pass an Array into a Function? in PHP? You can pass an array into a function in the same as a normal variable. No special syntax needed. Here is a PHP script on how to pass an array to a function: <?php function average($array) { $sum = array_sum($array); $count = count($array); retur...
2023-04-06, ∼1992🔥, 1💬

💬 2023-04-06 Durga: Good

Reading and Writing Files in PHP
Where to find tutorials on how to Read and Write Files in PHP? A collection of tutorials to answer many frequently asked questions how to Read and Write Files in PHP. Topics included in this collection are: Reading a Text File to an Array in PHP Reading the Entire File to a String in PHP Opening a f...
2023-03-01, ∼2815🔥, 1💬

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, ∼4083🔥, 1💬

💬 2022-12-14 /nme: /data

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, ∼5112🔥, 1💬

Uploading Files into Database in PHP
How To Upload Files into Database in PHP? 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: <?php $con = mysql_connect("localhost", "", ""); mysql_select_db("fyi"); $error = $_FILES['fyicente...
2017-02-20, ∼2588🔥, 1💬

💬 2017-02-20 Jonas: Thanks for the sample code!

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, ≈11🔥, 0💬

Index of Array Values in PHP
How Values in Arrays Are Indexed in PHP? 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: Numerical Array - All keys are sequential integers. Associative Array - All keys are st...
2017-02-03, ∼2807🔥, 0💬

Copying an Array in PHP
Can You Copy an Array in PHP? You can create a new array by copying an existing array using the assignment statement. Note that the new array is not a reference to the old array. If you want a reference variable pointing to the old array, you can use the reference operator "&". Here is a PHP...
2017-02-03, ∼2411🔥, 0💬

Data Types of Array Keys in PHP
What Types of Data Can Be Used as Array Keys in PHP? Two types of data can be used as array keys: string and integer. When a string is used as a key and the string represent an integer, PHP will convert the string into a integer and use it as the key. Here is a PHP script on different types of keys:...
2017-02-03, ∼2268🔥, 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, ∼1840🔥, 0💬

Copying Array Values to a List of Variables in PHP
How To Copy Array Values to a List of Variables in PHP? If you want copy all values of an array to a list of variable, you can use the list() construct on the left side of an assignment operator. list() will only take values with integer keys starting from 0. Here is a PHP script on how to use list(...
2017-01-29, ∼3342🔥, 0💬

PHP Built-in Functions for Arrays
Where to find tutorials on how to use PHP built-in functions to manage arrays? A collection of tutorials to answer many frequently asked questions on how to PHP functions to manage arrays. Clear answers are provided with tutorial exercises on searching keys and values, sorting arrays, merging two ar...
2017-01-29, ∼2414🔥, 0💬

Counting the Number of Values in an Array in PHP
How To Get the Total Number of Values in an Array in PHP? You can get the total number of values in an array by using the count() function. Here is a PHP example script: <?php $array = array("PHP", "Perl", "Java"); print_r("Size 1: ".count($array)."\n"); $array = array(); print_r("Size 2: ".c...
2017-01-29, ∼2081🔥, 0💬

Order of Array Values in PHP
How the Values Are Ordered in an Array in PHP? PHP says that an array is an ordered map. But how the values are ordered in an array? The answer is simple. Values are stored in the same order as they are inserted like a queue. If you want to reorder them differently, you need to use a sort function. ...
2017-01-29, ∼1904🔥, 0💬

Verifying If a Key Exists in an Array in PHP
How Do You Know If a Key Is Defined in an Array in PHP? There are two functions can be used to test if a key is defined in an array or not: array_key_exists($key, $array) - Returns true if the $key is defined in $array. isset($array[$key]) - Returns true if the $key is defined in $array. Here is a P...
2017-01-29, ∼1671🔥, 0💬

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

Sorting an Array by Values in PHP
How To Sort an Array by Values in PHP? Sorting an array by values is doable by using the sort() function. It will re-order all pairs of keys and values based on the alphanumeric order of the values. Then it will replace all keys with integer keys sequentially starting with 0. So using sort() on arra...
2017-01-21, ∼2027🔥, 0💬

Sorting an Array by Keys in PHP
How To Sort an Array by Keys in PHP? Sorting an array by keys can be done by using the ksort() function. It will re-order all pairs of keys and values based on the alphanumeric order of the keys. Here is a PHP script on how to use ksort(): <?php $mixed = array(); $mixed["Zero"] = "PHP"; $mixe...
2017-01-21, ∼2004🔥, 0💬

1 2 3 4 5 6 > >>   ∑:217  Sort:Rank