We can display our variables in a meaningful fashion with the use of concatenation. Concatenation makes use of the period (.). Please see the example below which is an example of affixing a value to the end of the variable:
<?php $name = “Marc”; $name .= “Fraser”; ?>
Basically what ‘.=’ is doing is saying use the current value of $name and add “Fraser” to the end of it. If I were to now print $name, it would output “MarcFraser”.
We can also use concatenation to create readable sentences:
<?php $name = “ Marc Fraser”; $age = 16; print “We would like to welcome you,” . $name . “, age” . $age . “ to our website!”; ?>
This will output “We would like to welcome you, Marc Fraser, age 16 to our website!”. To do this, we close the string (close quotation mark) and add our period, which tells the server that we wish to begin parsing PHP again. When we want to stop parsing PHP we add a period and then begin our string again (quotation mark).
I’m aware of this already, but nonetheless there are several beneficial pieces which finalized the picture for me, regards!
I seemed to be aware about this previously, but nevertheless there have been a few beneficial pieces that concluded the image for me personally, thank you so much!
Fine, that’s a nice beginning but i’ll have to consider that a tad more. Will show you just what else there is.
I was aware about this previously, but nonetheless there have been several helpful bits that concluded the picture for me, thanks a lot!