Need help with PHP preg_replace. Possible?

Discussion in 'PHP' started by JudeAustin, Mar 11, 2010.

  1. #1
    Hello.

    I am setting up mochi leaderboards for my arcade, and the only thing I can pull up for the game name is the name of the swf file for it to work.

    Right now I have <?php $values = get_post_custom_values("swf_url"); echo $values[0]; ?> which displays the url: http://mysite.com/games/game_name.swf

    I need that to just show the file name etc: game_name.swf with out the directory and address behind it.

    Could I possibly do this with preg_replace?
     
    JudeAustin, Mar 11, 2010 IP
  2. koko5

    koko5 Active Member

    Messages:
    394
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Hi,

    Just use basename
    Example:
    <?php $values = get_post_custom_values("swf_url"); echo basename($values[0]); ?>
    PHP:
    Regards :)
     
    koko5, Mar 12, 2010 IP
  3. JudeAustin

    JudeAustin Active Member

    Messages:
    409
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    56
    #3
    I got it all figured out.

    Thank you very much for your help tho!
     
    JudeAustin, Mar 20, 2010 IP