Menu

Add Topic

programming

waiting answer July 28, 2021

How to prepend a string in PHP

Answers
June 10, 2021

There is no built-in function to prepend a string in PHP. The PHP concatenation operator (.) is used to prepend a string with another string.

Let's check the following example to understand how this function actually works

    <?php
        $string1 = "Welcome to ";
        $string2 = "America";
        $b = $string1 . " " . $string2;
        echo $b; // Outputs: Welcome to America
    ?>
0 0

Please Login to Post the answer

Leave an Answer