3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $namespaceConstant = "a\\b\\c\\d"; $b = strrpos($namespaceConstant, '\\'); $namespacePart = substr($namespaceConstant, 0, $b); $constantPart = substr($namespaceConstant, $b); var_dump($namespacePart); var_dump($constantPart);
based on J8VZT
Output for 4.3.0 - 7.2.0
string(5) "a\b\c" string(2) "\d"