Jump to content

[SOLVED] Best way of doing this.


phpSensei

Recommended Posts

kenrbnsn already beat me to it, but I was taking a different approach and was having problem handling the spaces until I saw kenrbnsn elegant solution. here is a one line solution

 

<?php

$input = "My name is Sensei";

echo  str_replace(' |', ' ', implode('|', str_split($input)));

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.