Funday Friday – Let a thousand string concatenations bloom
How many different ways (in PHP) are there to concatenate the string values in two variables and put the result in a third variable?
Here are a few to start:
$alice = $bob . $charlie;
$alice = "$bob$charlie";
$alice = sprintf('%s%s', $bob, $charlie);
ob_start(); echo $bob, $charlie; $alice = ob_get_clean();
$alice = implode('', array($bob,$charlie));
I would say something like “Of course, this entire exercise is just for fun and in practice is totally useless,” but whenever I start out thinking that something actually productive eventually emerges. So perhaps this is totally useless, perhaps not!
Taken from : Sklar.com
One of the viewer’s comment : I suggest using a web service for this .. lol
Do you have any other solution? Please hit the reply button to post your own here.