For many years, I would write code like this:
$variable = ereg_replace('hello','goodbye', $varable);
Now, some nut who writes all the server software decided:
“Hey, I’ve got a better idea! Let’s prevent that sim,ple code from working and make people use preg_replace!”, “YEAH!”
I’ve been looking up how to use preg_replace all afternoon, trying to work out how to substitute it for the ereg_replace example above.
All I can find are pages that look like this:
"Oh, well if you want to change a word, you have to use adelimiter and slashes. Here’s a simple to understand example.
Set the demimiter of the punctuation for slashes behind the third loop of the apache module like this:"
preg_replace . "(/+) hello, ("/.*\\.(.*)$/", "\\\\1")+++ and; exit;
Then, simply revert to the 5th dimension, and ask for the continuum transfuctioner, and the wizard that appears behind the third rock will give you an encrypted key to write the second line of code:
(\\b+). "(\\s+2) "(/+) goodbye, "/.*\\.(.*)$/", "\\\\1"()+++ and(\\s+2) ; get coffee;
The, all you have to do is put it together, and you can repace a word. It couldn’t possibly be easier!
preg_replace . "(/+) hello, ("/.*\\.(.*)$/", "\\\\1",)+++ and; exit;
(\\b+). "(\\s+2) "(/+) goodbye, ()+++ and(\\s+2) ; ctrl+alt+del -- x2
Can someone please show me how to redo this, before I seriously destroy everything around me?
[COLOR=#ff0000]$myvariable = ereg_replace('www.','', $myvariable);[/COLOR]
I have tried to work it out for 3 hours, but these articles are giving me severe head trauma: