Jump to content

preg_replace help


lupld

Recommended Posts

but when used, you need to assign to the function return value:

 

<?php
$message = 'Joe once said, "There is no way to replace double quotes."';

$patterns = '/"/';
$replacements = '"';
$message = preg_replace("$patterns", $replacements, $message);

echo "message: $message \n";
?>

 

output:

message: Joe once said, "There is no way to replace double quotes."

Link to comment
https://forums.phpfreaks.com/topic/74251-preg_replace-help/#findComment-375101
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.