0

Hi hope you can help with this.

Fields have spaces in the fields being echoed, how would I use the replace to change those spaces to a dash.

'Make' field will be something like blar blar blar and I need it to be blar-blar-blar

<h4><a href="">'. $row['Make'].'</a></h4>
Hope you can help. Thanks

2
Contributors
4
Replies
6
Views
4 Years
Discussion Span
Last Post by LastMitch
0

@mpc123

'Make' field will be something like blar blar blar and I need it to be blar-blar-blar

Try this:

$string = preg_replace("/[\s_]/", "-", $string);

to make the dash appear

0

thanks for the reply and sorry to sound totally thick but where / how would I use it?

0

@mpc123

This is the code where the words have blar-blar-blar? Am I right?

$row['Make']

You missing full code that is related to the $row['Make']

To add this:

$string = preg_replace("/[\s_]/", "-", $string);

This code needs to be part of your code.

Edited by LastMitch: grammer

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.