Jump to content

Hi is there a way to use str_replace to replace if find two values?


Lisa23

Recommended Posts

hi is there a way of doing a str replace to look twice

like at moment i have if find space replace with "-"

PHP Code:

 .str_replace(' ','-',($row['model']))  

is there a way i can do if find twice

$row['model

if find space " " replace with "-" also if find "i30" replace with "10"

is there a way i can try find another like if find " " replace with "-" also if find "130" replace with hello world??

 

thanks in advance

Link to comment
Share on other sites

HYi thanks for the link i found out that i can do it this way

// Provides: You should eat pizza, beer, and ice cream every day
$phrase  = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy   = array("pizza", "beer", "ice cream");

$newphrase = str_replace($healthy, $yummy, $phrase);

but is there a way that i can just implement

.str_replace(' ','-','cars','bikes'($row['model']))  

is there?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.