In php
I am receiving one URL
that concatenates the title of a publication with an identifier. Axis: www.midominio.com/post/ultimas-noticias-empresariales-6BEDRCT94014R
I would like to get only that identifier (6BEDRCT94014R) after redirecting to that route.
try the following code, which validates that if there is a hyphen(-) I take what follows, but it turns out that since the title per publication can change then there may be many or few hyphens.
$str = substr($id_post, strrpos($id_post, '-') + 1);
The idea is that I always take the identifier that is after the last script.
I would appreciate the collaboration.
You can do it using explode like this: