I need to split a string in PHP by \"-\" and get the last part.
So from this:
abc-123-xyz-789
I expect to get
As has been mentioned by others, if you don't assign the result of explode() to a variable, you get the message:
E_STRICT: Strict standards: Only variables should be passed by reference
The correct way is:
$words = explode('-', 'hello-world-123');
$id = array_pop($words); // 123
$slug = implode('-', $words); // hello-world