DssTrainer Posted August 7, 2008 Share Posted August 7, 2008 It seems almost silly that I'm unsure how to do this, but it left me with a confused look on my face. If I do: $i = 0; $class = 'sub_cat_' . $i; echo $class; it shows "sub_cat_0" But, if I do: $i = 0; $class = 'sub_cat_' . ($i+1); echo $class; it just shows: "1" Why does it throw away the string if I am doing an equation after it? Link to comment https://forums.phpfreaks.com/topic/118649-solved-string-concat-with-number-and-operator/ Share on other sites More sharing options...
Xurion Posted August 7, 2008 Share Posted August 7, 2008 It doesn't; I just tested it and it echos 'sub_cat_1'. Link to comment https://forums.phpfreaks.com/topic/118649-solved-string-concat-with-number-and-operator/#findComment-610836 Share on other sites More sharing options...
DssTrainer Posted August 7, 2008 Author Share Posted August 7, 2008 Ah.. you know what.. i didn't have the parenthesis in there. I added those when I typed up this thread... It removes the string when i leave the parenthesis out. But you are right, as long as I have them in, it works. Sorry.. I need more sleep Link to comment https://forums.phpfreaks.com/topic/118649-solved-string-concat-with-number-and-operator/#findComment-610846 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.