The only operators that can operate on strings are . and .= which are for concatenation and concatenation assignment respectively.
Strings can be treated as arrays i.e., individual characters can be accessed using the index values. The index value begins with zero. A character at index i can be retrieved as $str[i]. An example is given below:
<?php
$str1 = "master";
print($str1[2]);
?>
The print statement in the above code prints ‘s’.
There are several predefined functions to manipulate strings. Some of them are listed below:
Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.
He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.
He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.
Leave a Reply