Add a text in a string PHP -
i have text.
$text='userpics/115/x3wgoc0009ja.jpg';
i want add together letter p
before x3wgoc0009ja.jpg
, output
$text='userpics/115/px3wgoc0009ja.jpg'; ---^
i new php, don't know try, hoping guide me in right direction
you can explode slash 1 way.
$exploded_text = explode('/', $text); $new_text = $exploded_text[0] . $exploded_text[1] . 'p' . $exploded_text[2];
it's not best way, work.
php string
No comments:
Post a Comment