Help me out please. total string is "http://cdn.total.com/v/gfx/apps/72850/header_292x136.jpg" trying to get only the numbers inside it (72850). means the numbers inside the / /. It wont be always 5 digits, it can change. so if $url = "http://cdn.total.com/v/gfx/apps/numbers/header_292x136.jpg"; i want to echo only the red part. Thank you.
<?php $url = "http://cdn.total.com/v/gfx/apps/72850/header_292x136.jpg"; $display preg_replace("/[^0-9]/", '', $url); echo $display; ?> PHP: That should do it
<?php $url = "http://cdn.total.com/v/gfx/apps/72850/header_292x136.jpg"; $display = preg_split ('/\//', $url, 0); echo $display[6]; ?> PHP: Try that