If $GLOBALS['filefolder'] = 13.pressrum
How come
$filefolder = '/'+$GLOBALS['filefolder'];
echo $filefolder
output 13
When
$filefolder = $GLOBALS['filefolder'];
echo $filfolder
outputs 13.pressrum
The operator + is numeric / mathematical in PHP.
So '/'+$GLOBALS['filefolder']; is equal to 0+13 in your case (php casts both to integer) which actually is 13.
To concatenate use .
$filefolder = '/' . $GLOBALS['filefolder'];
echo $filefolder
A + adds two numbers as in 1+1. So if you use it to concatenate two strings, they get converted to integers internally and thus the result is 13. A dot (.) concatenates two string. So you have to write $filefolder = '/'.$GLOBALS['filefolder'];
You probably confused it with JavaScript, where + is used to concatenate strings (and also for adding numbers, but that's another topic...).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With