<< < 15 16 17 18 19 20   Sort: Rank

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!   ⇒Understanding PHP String Literals ...
2016-10-13, 289👍, 0💬

Remove Trailing New Line Character in PHP
How To Remove the New Line Character from the End of a Text Line? 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: &lt;?php $handle = fopen("/tmp/inputfile.txt"...
2016-10-13, 284👍, 0💬

Counting the Number of Characters in PHP
How To Count the Number of Characters in a String? You can use the "strlen()" function to count the number of characters in a string. Here is a PHP script example of strlen(): &lt;?php print(strlen('It\'s Friday!')); ?&gt; This script will print: 12   ⇒PHP Built-in Functions for Strings ⇒⇒P...
2016-10-13, 275👍, 0💬

Converting Strings to Hex Numbers in PHP
How To Convert Strings to Hex Numbers? 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($string)."\n"); ?&gt; This script will print: Hello ...
2016-10-13, 320👍, 0💬

Comparing Two Strings with strcmp() in PHP
How To Compare Two Strings with strcmp()? 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, which compares two strings based on ASCII values of their...
2016-10-13, 318👍, 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, 304👍, 0💬

Replacing Characters in a String in PHP
How To Replace a Group of Characters by Another Group? 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 format to stop email spammer collecting real email address...
2016-10-13, 295👍, 0💬

Joining Multiple Strings in PHP
How To Join Multiple Strings into a Single String? 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(): &lt;?php $date = array('01', '01', '2006'); $keys =...
2016-10-13, 291👍, 0💬

Testing the strpos() Return Value in PHP
What Is the Best Way to Test the strpos() Return Value? Because strpos() could two types of values, Integer and Boolean, you need to be careful about testing the return value. The best way is to use the "Identical(===)" operator. Do not use the "Equal(==)" operator, because it does not differentiate...
2016-10-13, 289👍, 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, 278👍, 0💬

Converting Strings to Upper/Lower Case in PHP
How To Convert Strings to Upper or Lower Cases? 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: &lt;?php $string = "PHP string functions are easy to use."; $lower = strtolower($string); $upper = strtou...
2016-10-13, 277👍, 0💬

Applying UUEncode to a String in PHP
How To Apply UUEncode to a String? 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 two functions for you to UUEncode or UUDecode a string:...
2016-10-13, 272👍, 0💬

Replacing a Substring in PHP
How To Replace a Substring in a Given String? 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(): &lt;?php $string = "Warning: System will shutdown...
2016-10-13, 270👍, 0💬

Converting Leading Characters to Upper Case in PHP
How To Convert Leading Characters to Upper Case? 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. H...
2016-10-13, 268👍, 0💬

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(): &lt;?php $string = "TRADING ON MARGIN POSES ADDITIONAL RISKS AND IS NOT SUITABLE FOR ALL INVESTORS. A COMPLETE LIST OF THE RI...
2016-10-13, 263👍, 0💬

Finding a Substring in PHP
How to Find a Substring from a Given String? To find a substring in a given string, you can use the strpos() function. If you call strpos($haystack, $needle), it will try to find the position of the first occurrence of the $needle string in the $haystack string. If found, it will return a non-negati...
2016-10-13, 257👍, 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 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(): &...
2016-10-13, 253👍, 0💬

Generating Character from ASCII Value in PHP
How To Generate a Character from an ASCII Value? 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() complements ord(). Here is a PHP script on how to use c...
2016-10-13, 248👍, 0💬

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...
2016-10-13, 5825👍, 0💬

<< < 15 16 17 18 19 20   Sort: Rank