Sen) olsa da, str_ireplace()
if you want to replace the whole string or convert your LIKE-parameter to a regular expression and use preg_replace()
(don't forget to preg_quote()
a> dize kullanabilirsiniz.
Düzenli ifadeler kullanarak bir örnek:
$parts = explode('%', $likeQuery)
foreach ($parts as &$innerString) {
$innerParts = explode('_', $innerString);
foreach ($innerParts as &$part) {
$part = preg_quote($part, '/');
}
// always unset references when you're done with them
unset($part):
$innerString = implode('.', $innerString);
}
// always unset references when you're done with them
unset($innerString):
$regex = implode('.*?', $parts);
$transformedString = preg_replace("/$regex/", '<span>$0</span>', $stringToTransform);