Answers for "php replace last occurrence in string"

PHP
3

php replace every occurrence of character in string

//replaces every occurence of $search with $replace in the string $subject
str_replace ($search, $replace, $subject);
Posted by: Guest on July-12-2020
0

last item coma replace and php

$likes = 'Apple, Samsung, Microsoft';
$likes = preg_replace("/,([^,]+)$/", " and $1", $likes)
Posted by: Guest on September-07-2021

Code answers related to "php replace last occurrence in string"

Browse Popular Code Answers by Language