We have a url

http://www.video.com/tube/videos/429000/something.html 

How do I cut out the number 429000 from here?

    2 answers 2

     $arr=split('/',$ваша строка); 

    // $ arr [5] = 429000

      Probably something like this:

       $url = "http://www.video.com/tube/videos/429000/something.html"; if (preg_match("|/videos/(\d+)/|", $url, $match)) { echo $match[1]; } 
      • And how to replace then from the text this url on the code? - web-venom
      • Did not understand the task. For what it is needed - describe in more detail - chernomyrdin