开发者

Name of PHP function [closed]

As it currently stands, this question is not a good fit for our Q&A format. We开发者_高级运维 expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 11 years ago.

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");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜