PHP String Variables
A string variable is used to store and manipulate text.
String Variables in PHP
String variables are used for values that contains characters.
In this chapter we are going to look at the most common functions and operators used to manipulate
strings in PHP.
After we create a string we can manipulate it. A string can be used directly in a function or it can be stored in a variable.
Below, the PHP script assigns the text "Hello World" to a string variable called $txt:
The output of the code above will be:
Hello World
Now, lets try to use some different functions and operators to manipulate the string.
Chunksplit()
addcslashes() and backcslahes()
chop()
chr()
implode()
nl2br()
strrev()
strlen()
substr()
trim()
A string variable is used to store and manipulate text.
String Variables in PHP
String variables are used for values that contains characters.
In this chapter we are going to look at the most common functions and operators used to manipulate
strings in PHP.
After we create a string we can manipulate it. A string can be used directly in a function or it can be stored in a variable.
Below, the PHP script assigns the text "Hello World" to a string variable called $txt:
?php $txt="Hello World"; echo $txt; ? |
The output of the code above will be:
Hello World
Now, lets try to use some different functions and operators to manipulate the string.
Chunksplit()
addcslashes() and backcslahes()
chop()
chr()
implode()
nl2br()
strrev()
strlen()
substr()
trim()
0 comments:
Post a Comment