I have this small code , why it does not work and how to make it correctly ?
$temp = $_SESSION['contactPersonInterest'][$i];
$temp += ',Medlemskort';
//$_SESSION['contactPersonInterest'][$i] = $temp;
I am testing it with
?><script>alert('<?php echo $_SESSION['contactPersonInterest'][$i] ?>'+'----------'+'<?php echo $temp ?>');</script> <?php
And what i get is :
blbla,blll----------0
Whats wrong ?
Thank you
String concatenation is done with
.in PHP. Try:Otherwise you perform addition, and if both strings don’t start with numbers, they will be converted to
0and0 + 0 = 0🙂Have a look at Type Juggling.