php - Strange behaviour from ltrim() with forward slash -


i need remove beginning part of url:

$test = "price/edit.php"; echo ltrim($test,'price/'); 

shows dit.php

here codepad if want fiddle: https://codepad.remoteinterview.io/dominantcalmingberlinprice

any ideas going on? want echo edit.php of course.

ltrim removes characters found, consider following:

$test = 'price/edit.php'; echo ltrim($test, 'dprice/'); // outputs t.php 

for particular scenario, should using str_replace.


Comments