3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $slasher = function ($str) { $str = preg_replace('/\{1,}/','\\',$str); $str = trim($str,'\\'); return $str; }; echo $slasher('\test\class\\\Path\\');
based on 7tFAm
Output for 5.6.0 - 7.3.0alpha1
test\class\\Path