I’m very new to php and I’m trying to concatenate three strings. And this works, if I do so:
echo Test::getBaseUrl() , '/' , $append_url;
But this happens inside the method and I wish to return this to the callee, but when I add return instead of echo like this:
return Test::getBaseUrl() , '/' , $append_url;
I get an error like this :
PHP Parse error: syntax error, unexpected ',' in /home/ubuntu/Test.php on line 31
Where I’m making the mistake?
echois a language construct and it supports a special syntax, that allows to chain severalecho-“actions”. This meansis in fact
(not really, it’s a little bit different, but thats not important)
What you are really looking for is the concatenation
which (because this is a regular operator) works with everything, that can handle a string