<< < 2 3 4 5 6 7 8 9 10 11 > >>   Sort: Rank

How To Compare Two Strings with strcmp()
How To Compare Two Strings with strcmp()? - PHP Script Tips - PHP Built-in Functions for Strings PHP supports 3 string comparison operators, &lt;, ==, and &gt;, that generates Boolean values. But if you want to get an integer result by comparing two strings, you can the strcmp() function, wh...
2007-04-21, 7433👍, 0💬

How To Use an Array as a Stack
How To Use an Array as a Stack? - PHP Script Tips - PHP Built-in Functions for Arrays A stack is a simple data structure that manages data elements following the first-in-last-out rule. You use the following two functions together to use an array as a stack: array_push($array, $value) - Pushes a new...
2007-04-21, 4999👍, 0💬

How To Use an Array as a Queue
How To Use an Array as a Queue? - PHP Script Tips - PHP Built-in Functions for Arrays 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 ne...
2007-04-21, 8152👍, 0💬

How To Generate a Character from an ASCII Value
How To Generate a Character from an ASCII Value? - PHP Script Tips - PHP Built-in Functions for Strings If you want to generate characters from ASCII values, you can use the chr() function. chr() takes the ASCII value in decimal format and returns the character represented by the ASCII value. chr() ...
2007-04-21, 4702👍, 0💬

How To Convert Strings in Hex Format
How To Convert Strings in Hex Format? - PHP Script Tips - PHP Built-in Functions for Strings 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(): &lt;?php $string = "Hello\tworld!\n"; print($string."\n"); print(bin2hex($s...
2007-04-21, 5194👍, 0💬

How To Merge Values of Two Arrays into a Single Array
How To Merge Values of Two Arrays into a Single Array? - PHP Script Tips - PHP Built-in Functions for Arrays You can use the array_merge() function to merge two arrays into a single array. array_merge() appends all pairs of keys and values of the second array to the end of the first array. Here is a...
2007-04-21, 9385👍, 0💬

How To Join a List of Keys with a List of Values into an Array
How To Join a List of Keys with a List of Values into an Array? - PHP Script Tips - PHP Built-in Functions for Arrays If you have a list keys and a list of values stored separately in two arrays, you can join them into a single array using the array_combine() function. It will make the values of the...
2007-04-21, 6404👍, 0💬

How To Convert a Character to an ASCII Value
How To Convert a Character to an ASCII Value? - PHP Script Tips - PHP Built-in Functions for Strings 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() complem...
2007-04-21, 4979👍, 0💬

How To Split a String into Pieces
How To Split a String into Pieces? - PHP Script Tips - PHP Built-in Functions for Strings 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...
2007-04-21, 5174👍, 0💬

How To Sort an Array by Values
How To Sort an Array by Values? - PHP Script Tips - PHP Built-in Functions for Arrays 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 sequen...
2007-04-21, 5183👍, 0💬

How To Sort an Array by Keys
How To Sort an Array by Keys? - PHP Script Tips - PHP Built-in Functions for Arrays 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(): &lt;?php ...
2007-04-21, 5020👍, 0💬

How To Join Multiple Strings into a Single String
How To Join Multiple Strings into a Single String? - PHP Script Tips - PHP Built-in Functions for Strings 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(): ...
2007-04-21, 4632👍, 0💬

How To Get All the Values Out of an Array
How To Get All the Values Out of an Array? - PHP Script Tips - PHP Built-in Functions for Arrays Function array_values() returns a new array that contains all the keys of a given array. Here is a PHP script on how to use array_values(): &lt;?php $mixed = array(); $mixed["Zero"] = "PHP"; $mixed[1...
2007-04-21, 4678👍, 0💬

How To Apply UUEncode to a String
How To Apply UUEncode to a String? - PHP Script Tips - PHP Built-in Functions for Strings UUEncode (Unix-to-Unix Encoding) is a simple algorithm to convert a string of any characters into a string of printable characters. UUEncode is reversible. The reverse algorithm is called UUDecode. PHP offeres ...
2007-04-21, 4520👍, 0💬

How To Get All the Keys Out of an Array
How To Get All the Keys Out of an Array? - PHP Script Tips - PHP Built-in Functions for Arrays 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] = "P...
2007-04-21, 4763👍, 0💬

How To Replace a Group of Characters by Another Group
How To Replace a Group of Characters by Another Group? - PHP Script Tips - PHP Built-in Functions for Strings While processing a string, you may want to replace a group of special characters with some other characters. For example, if you don't want to show user's email addresses in the original for...
2007-04-20, 4838👍, 0💬

What Are the Special Characters You Need to Escape in Single-Quoted Stings
What Are the Special Characters You Need to Escape in Single-Quoted Stings? - PHP Script Tips - Understanding String Literals and Operations There are two special characters you need to escape in a single-quote string: the single quote (') and the back slash (\). Here is a PHP script example of sing...
2007-04-20, 4525👍, 0💬

How To Find a Specific Value in an Array
How To Find a Specific Value in an Array? - PHP Script Tips - PHP Built-in Functions for Arrays There are two functions can be used to test if a value is defined in an array or not: array_search($value, $array) - Returns the first key of the matching value in the array, if found. Otherwise, it retur...
2007-04-20, 4795👍, 0💬

How Do You If a Key Is Defined in an Array
How Do You If a Key Is Defined in an Array? - PHP Script Tips - PHP Built-in Functions for Arrays 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 ...
2007-04-20, 4696👍, 0💬

Can You Specify the "new line" Character in Single-Quoted Strings
Can You Specify the "new line" Character in Single-Quoted Strings? - PHP Script Tips - Understanding String Literals and Operations You can not specify the "new line" character in a single-quoted string. If you don't believe, try this script: &lt;?php echo '\n will not work in single quoted stri...
2007-04-20, 4568👍, 0💬

How To Get the Total Number of Values in an Array
How To Get the Total Number of Values in an Array? - PHP Script Tips - PHP Built-in Functions for Arrays You can get the total number of values in an array by using the count() function. Here is a PHP example script: &lt;?php $array = array("PHP", "Perl", "Java"); print_r("Size 1: ".count($array...
2007-04-20, 4767👍, 0💬

How Many Escape Sequences Are Recognized in Single-Quoted Strings
How Many Escape Sequences Are Recognized in Single-Quoted Strings? - PHP Script Tips - Understanding String Literals and Operations There are 2 escape sequences you can use in single-quoted strings: \\ - Represents the back slash character. \' - Represents the single quote character.
2007-04-20, 4517👍, 0💬

How To Copy Array Values to a List of Variables
How To Copy Array Values to a List of Variables? - PHP Script Tips - Understanding PHP Arrays and Their Basic Operations 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 integ...
2007-04-20, 4846👍, 0💬

How the Values Are Ordered in an Array
How the Values Are Ordered in an Array? - PHP Script Tips - Understanding PHP Arrays and Their Basic Operations 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 wa...
2007-04-20, 4594👍, 0💬

<< < 2 3 4 5 6 7 8 9 10 11 > >>   Sort: Rank