The only operators that can operate on strings are . and .= which are for concatenation and concatenation assignment respectively.
This article is a part of our advanced java and web technologies tutorial.
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:
Next let’s learn about functions in PHP.

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