PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
mattyboi
Forum Commoner
Posts: 34 Joined: Mon Feb 06, 2006 9:42 pm
Post
by mattyboi » Fri Feb 10, 2006 12:54 pm
Hey guys,
I am embarressed to even ask this question.
I am trying to combine a varible with the value of '1' with the letter 'a' and assigning it to a new varible.
Code: Select all
<?php
$i = 1;
$check = "$i'a'";
echo("$check");
?>
The output should be "1a".
Thanks
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Feb 10, 2006 12:56 pm
Code: Select all
<?php
$i = 1;
$check = $i . 'a';
echo($check);
?>
No0b
Forum Commoner
Posts: 37 Joined: Tue Feb 07, 2006 6:17 pm
Post
by No0b » Sat Feb 11, 2006 12:48 pm
The
in fayds post means it's concatenating your $i var with the string "a". Concatenating means to on to. For example:
Code: Select all
$results = "$i";
//then concatenate the var
$results .= "a"
the .= is concatenating the var $results with a new string. This is useful when you want to keep a value of a var and add to it.