Replace character of a string

Asked

Viewed 100 times

-1

I’m trying to remove all the hyphens from mine string when she is returned.

$hash = $result[2];

Call me back:

0DE8072B-C3BE-4A94-B412-3679F7C79913

I want to define a variable that removes all hyphens from the variable $hash

2 answers

2

You can use the str_replace in this case, replacing the hyphen with an empty string, thus:

$hash = str_replace("-", "", $result[2]);

0

Use the function str_replace()

$new_var = str_replace("-", "alguma coisa", $hash);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.