Hello! Tell me, please, how in the line to replace the forward slash with the underscore '_'. Below is the code, but for some reason it does not work:
$vv = 'SAMSUNG/1'; $model = str_replace('\/', '_', $vv); Hello! Tell me, please, how in the line to replace the forward slash with the underscore '_'. Below is the code, but for some reason it does not work:
$vv = 'SAMSUNG/1'; $model = str_replace('\/', '_', $vv); Your code does not work, because the preg_replace function is used for regular expressions. In the case of str_replace , the correct code will look like this:
$vv = 'SAMSUNG/1'; $model = str_replace('/', '_', $vv); If the condition is to use regular expressions, then:
$vv = 'SAMSUNG/1'; $model = preg_replace('/\//', '_', $vv); Source: https://ru.stackoverflow.com/questions/521815/
All Articles