Jump to content

preg_replace help


koolaidman52

Recommended Posts

I'm helping a freidn out with a website for our school basketball team and we recently ran into a problem. I rushed in thinking that with my superior knowledge of all things php I would be able to solve any complex error he may have, but I can't figure out the proper way to use preg_replace() in this situaition (or if I need to use it at all).

[code]
$blah = $_SERVER['REQUEST_URI'];
// $blah is /knights%20basketball/varsity/footer.php
$blah = str_replace("/footer.php", "", $blah);
// $blah is now /knights%20basketball/varsity
//the following line of code is the problem i can't figure out what to put as the first argument.
$blah = preg_replace('', '$1', $blah);
// the /knight%20basketball/ changes so I can't just have it search and remove that.
// $blah should now just be varsity
// but it isn't
echo $blah;
[/code]

please dont direct me to the php manual that didn't help
thanks for the help
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.