Table of Contents
There’s no exact function to prepend a string in PHP. But PHP concatenation operator (.) is used to returns the concatenation of its left and right arguments.
There are two string operators :
- Concatenation operator (‘.’) – Concatenation of str1 and str2
Example: $str1 . $str2
- Concatenating assignment operator (‘.=’) – Appends the str2 to the str1
Example: $str1 .= $str2