One way to prepend a string to the beginning of another string in PHP is to use the concatenation operator (.
) in the following way:
main.php98 chars4 lines
Alternatively, for a more concise solution, you can also use the string concatenation assignment operator (.=
) like so:
main.php161 chars5 lines
In both cases, the output will be the same: Hello, John Doe
.
gistlibby LogSnag