PHP Operators: Using String Concatenation Operator
Posted by Daniel at 11:03 pm
You can concatenate or add strings together using the PHP string concatenation operator represented by the period sign ( . ). refer to the examples below.
<?php // intialize variables $username = "daniel"; $domain = "danieldumas.com"; // the variable string $username and $domain can be combine using the concatenation operator $email_address = $username . '@'. $domain; //the variable $email_address now contains the value "daniel@danieldumas.com" ?>
You can also concatenate simultaneously. .
<?php $name = "dan"; //add and assign values to the string $name.. $name .= "iel"; //the variable $name now contains "daniel" ?>
[...] more: PHP Operators: Using String Concatenation Operator Related ArticlesBookmarksTags PHP PHP is a computer scripting language. Originally [...]