Searching a string, then running a function once a result is found?

Discussion in 'PHP' started by Phil Vessey, Nov 16, 2007.

  1. #1
    Hi
    I am building a small attachments system and am wanting to search a string for all instances of
     
    Phil Vessey, Nov 16, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    
    if (preg_match('~[attachment]~i', $str))
    {
        run_function();
    }
    
    PHP:
    Like this?
     
    nico_swd, Nov 16, 2007 IP