A
A
Aibek Zhaksybaev2018-04-29 08:50:39
PHP
Aibek Zhaksybaev, 2018-04-29 08:50:39

How to cut out the desired part in the url?

hello everyone, i have a url

http://picsbu/photo-by?=sportbible/1767719088825304873/812791281/shortcode/BiIMyVAHAcp

How to cut shortcode here - BiIMyVAHAcp.
Thank you all in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
gupovski, 2018-04-29
@gupovski

Function explode on slashes

M
Maxim Shcherbakov, 2018-04-29
@UnknownError

$url = 'http://picsbu/photo-by?=sportbible/1767719088825304873/812791281/shortcode/BiIMyVAHAcp';
$shortcode = preg_replace("/(.*)\/shortcode\/(.*)/", '$2', $url); // BiIMyVAHAcp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question