How to prepend a string in PHP

 1 month ago
source link: https://www.laravelcode.com/post/how-to-prepend-a-string-in-php
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How to prepend a string in PHP


  2 years ago


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:

$a = "Hello";
$b = "World!";
$b = $a . " " . $b;
echo $b; // Outputs: Hello World!

I hope you like this small article.

Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on harsukh21@gmail.com

About Joyk

Aggregate valuable and interesting links.
Joyk means Joy of geeK