I'm trying to remove a part of a directory with PHPs ltrim(), however the result is unexpected. The first letter of my result has the wrong ascii value, and shows up as missing character/box in the browser.
Here is my code:
$stripPath = "public\docroot\4300-4399\computer-system-upgrade";
$directory = "public\docroot\4300-4399\computer-system-upgrade\3.0 Outgoing Documents";
$shortpath = ltrim($directory, $stripPath);
echo $shortpath;
Expected output:
3.0 Outgoing Documents
Actual output:
.0 Outgoing Documents
Note the invisible/non-print character before the dot. Ascii value changed from Hex 33 (the number 3) to Hex 03 (invisible character). I also tried str_replace() instead of trim(), but the result stays the same.
What am i doing wrong here? How would i get the expected result "3.0 Outgoing Documents"?