WEB TUTORIALS
PRACTICE EXAMPLES
HTML REFERENCES
CSS REFERENCES
PHP REFERENCES

How to prepend a string in PHP

Topic: PHP / MySQLPrev|Next

Answer: Use the PHP Concatenation Operator

There is no specific function to prepend a string in PHP. But you can use the PHP concatenation operator (.) to prepened a string with another string.

Let's take a look at the following example to understand how it basically works:

<?php
$a = "Hello";
$b = "World!";
$b = $a . " " . $b;
echo $b; // Outputs: Hello World!
?>

See the tutorial on PHP operators to learn about the operators in detail.


Related FAQ

Here are some more FAQ related to this topic:

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties