Name of PHP function [closed]
Is there a PHP function that replaces -
with _
(underscores) ?
Like
my-name
with
my_name
str_replace('-', '_', $name)
You need to use the return of str_replace!
$name = str_replace('-', '_', $name);
There's, but it's not called replace_hyphen, it's str_replace
str_replace('-', '_', $str);
Use this
str_replace("-", "_", "my-name");
精彩评论