Jump to content

concat not working


tjmbc

Recommended Posts

$first_friend = "Bobby";

$relationship = " is friends with ";

$first_half_of_string = "Ricky";

 

$second_half_of_string = " who".$relationship.$first_friend;    Returns: who is friends with Bobby

 

$full_string = $first_half_of_string.$second_half_of_string;  Returns: Ricky who

 

Why is the full string "Ricky who is friends with Bobby" not returned? The string stops at who...?

Link to comment
https://forums.phpfreaks.com/topic/104121-concat-not-working/
Share on other sites

it does for me.

 

$first_friend = "Bobby";
$relationship = " is friends with ";
$first_half_of_string = "Ricky";

$second_half_of_string = " who".$relationship.$first_friend;

echo "second_half_of_string: $second_half_of_string<BR>";

$full_string = $first_half_of_string.$second_half_of_string;

echo "full_string: $full_string";

 

output:

 

second_half_of_string: who is friends with Bobby

full_string: Ricky who is friends with Bobby

 

Link to comment
https://forums.phpfreaks.com/topic/104121-concat-not-working/#findComment-533056
Share on other sites

And what the hell are those half a mile long variables.

 

The OP's concept of rationally-named variables that are easy to understand when you look at code in six months' time :)

 

Clearly, what's posted here produces exactly the desired result. If the OP isn't getting the same result, then likely their code is different, or not uploaded to the server, etc.

Link to comment
https://forums.phpfreaks.com/topic/104121-concat-not-working/#findComment-533103
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.