String Functions and Operations: by Raja Afzal Shah
String Functions and Operations: by Raja Afzal Shah
Syntax
strlen(string)
Example
<?php
echo strlen("Hello world!");
?>
PHP substr() Function
The substr() function returns a part of a
string.
Syntax
substr(string,start,length)
Example
<?php
echo substr("Hello world!",6);
echo substr("Hello world!",6,5);
?>
PHP trim() Function
<?php
echo trim(“ Hello World ”);
?>
Assignment # 1
Enter String Text
Click
Output
Assignment # 2
Click
Output
Assignment # 3
Click
Output