1 2 >   Sort: Rank

How To Remove White Spaces from the Beginning and/or the End of a String
How To Remove White Spaces from the Beginning and/or the End of a String? - PHP Script Tips - PHP Built-in Functions for Strings There are 4 PHP functions you can use remove white space characters from the beginning and/or the end of a string: trim() - Remove white space characters from the beginnin...
2007-04-22, 4886👍, 0💬

How To Get the Number of Characters in a String
How To Get the Number of Characters in a String? - PHP Script Tips - PHP Built-in Functions for Strings You can use the "strlen()" function to get the number of characters in a string. Here is a PHP script example of strlen(): <?php print(strlen('It\'s Friday!')); ?> This script will p...
2007-04-22, 4304👍, 0💬

How To Remove the New Line Character from the End of a Text Line
How To Remove the New Line Character from the End of a Text Line? - PHP Script Tips - PHP Built-in Functions for Strings 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 sc...
2007-04-22, 4428👍, 0💬

How To Remove Leading and Trailing Spaces from User Input Values
How To Remove Leading and Trailing Spaces from User Input Values? - PHP Script Tips - PHP Built-in Functions for Strings If you are taking input values from users with a Web form, users may enter extra spaces at the beginning and/or the end of the input values. You should always use the trim() funct...
2007-04-22, 4538👍, 0💬

What Is the Best Way to Test the strpos() Return Value
What Is the Best Way to Test the strpos() Return Value? - PHP Script Tips - PHP Built-in Functions for Strings 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 ...
2007-04-21, 4536👍, 0💬

How to Find a Substring from a Given String
How to Find a Substring from a Given String? - PHP Script Tips - PHP Built-in Functions for Strings 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 ...
2007-04-21, 4642👍, 0💬

How To Replace a Substring in a Given String
How To Replace a Substring in a Given String? - PHP Script Tips - PHP Built-in Functions for Strings 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()...
2007-04-21, 4393👍, 0💬

How To Take a Substring from a Given String
How To Take a Substring from a Given String? - PHP Script Tips - PHP Built-in Functions for Strings 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(): <?php $string = "beginning"; pri...
2007-04-21, 4437👍, 0💬

How To Convert Strings to Upper or Lower Cases
How To Convert Strings to Upper or Lower Cases? - PHP Script Tips - PHP Built-in Functions for Strings 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: <?php $string = "PHP string functions are easy ...
2007-04-21, 5116👍, 0💬

How To Reformat a Paragraph of Text
How To Reformat a Paragraph of Text? - PHP Script Tips - PHP Built-in Functions for Strings 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 NO...
2007-04-21, 4515👍, 0💬

How To Convert the First Character to Upper Case
How To Convert the First Character to Upper Case? - PHP Script Tips - PHP Built-in Functions for Strings 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 ...
2007-04-21, 4907👍, 0💬

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, <, ==, and >, 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, 7031👍, 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, 4467👍, 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(): <?php $string = "Hello\tworld!\n"; print($string."\n"); print(bin2hex($s...
2007-04-21, 4925👍, 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, 4752👍, 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, 4835👍, 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, 4372👍, 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, 4285👍, 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, 4593👍, 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, 4246👍, 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: <?php echo '\n will not work in single quoted stri...
2007-04-20, 4341👍, 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, 4257👍, 0💬

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

How Many Escape Sequences Are Recognized in Double-Quoted Strings
How Many Escape Sequences Are Recognized in Double-Quoted Strings? - PHP Script Tips - Understanding String Literals and Operations There are 12 escape sequences you can use in double-quoted strings: \\ - Represents the back slash character. \" - Represents the double quote character. \$ - Represent...
2007-04-20, 4312👍, 0💬

1 2 >   Sort: Rank