You want to find the length of a string.
Use strlen(). It requires a string as its argument and returns an integer representing the number of characters in the string.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN"> <head> <title>PHP</title> <meta Name="Author" Content="Hann So"> </head> <body> <p> <?php $hello = "Hello World"; echo $hello, "<br />"; echo "the length of the string is: ", strlen($hello), "<br />"; ?> </p> </body> </html> |