I have some strings like A Paper
, B Wood
, C Cotton
and I need to delete the first letter and the space and have Paper
, Wood
, Cotton
. I tried this.
<?php
$str = 'A Paper';
$new_str = str_replace('? ', '', $str);
echo $new_str;
?>
How to write function str_replace()
like:
$new_str = str_replace('(any character) ', '', $str);
You could use the library function substr_replace as:
$str = substr_replace($str,$char,$pos,1);
Edit
For this case:
$new_str = substr_replace($str, '', 0, 2);