Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Remove part of text

    hi, i am working on a php image to display whats playing on my radio station, i have it all working as i've done hundreds of these before


    in the Current DJ bit i just wanted it to saythe DJ's name instead of the whole POTUK--RAIO--DJ Whoever, is there a function to remove this part of it or will i just have to use

    Code:
    if($servertitle == "POTUK--RADIO--DJ Switchie") {
    $dj = "Switchie";}
    which is tedious as we have guest dj's, and people are constantly messing with their names and i dont want to add them each time, thanx in advance

  • #2
    Regular Coder
    Join Date
    Jun 2004
    Posts
    565
    Thanks
    0
    Thanked 18 Times in 18 Posts
    PHP Code:
    if(strpos($dj'POTUK--RADIO--DJ ') === 0)
    {
        
    $dj substr(strlen('POTUK--RADIO--DJ '));

    dumpfi
    "Failure is not an option. It comes bundled with the software."
    ....../)/)..(\__/).(\(\................../)_/)......
    .....(-.-).(='.'=).(-.-)................(o.O)...../<)
    ....(.).(.)("}_("}(.)(.)...............(.)_(.))Ż/.
    ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
    Little did the bunnies suspect that one of them was a psychotic mass murderer with a 6 ft. axe.

  • #3
    New to the CF scene
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanx, but that didnt work, i got the "image cannot be displayed because it contains errors" message. if i posted the entire script as is, maybe you could see what is wrong with it?

  • #4
    Regular Coder
    Join Date
    May 2006
    Posts
    101
    Thanks
    0
    Thanked 1 Time in 1 Post
    You are getting error because of wrong syntax of substr. Replace it with

    $dj = substr($dj,strlen('POTUK--RADIO--DJ '));


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •