php3-list | 199807
Date: 07/02/98
- Next message: sean <email protected>: "Re: [PHP3] [OFF TOPIC] FrontPage woes..."
- Previous message: Marcus Johansson: "Re: [PHP3]"
- In reply to: Marcus Johansson: "Re: [PHP3]"
- Next in thread: Zeev Suraski: "Re: [PHP3]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>eg. echo "This is my ".$a[b][1]." variable";
>
>That's a feature I didn't know about!
>Can I use it to add strings together?
>
>$a=$b.$c;
>instead of
>$a=$b+$c; ?
Since the first release of PHP3, the "." operator has been fro string
concatenation. Your first example above will work as expected, the second
one won't. The second one will try (I believe) to convert $b and $c to
numbers, and then add them, probably resulting in $a equaling 0 (a number,
not a string).
So yes: "." adds strings together, everywhere.
>Does it work on functions too?
How do you mean? You can't add two functions. However, if you have
something like:
<?
function foo() {
return "Hello ";
}
function bar() {
return "World";
}
$a = foo().bar();
echo $a;
echo foo().bar();
?>
You will get "Hello World" twice.
.........................................................................
Colin Viebrock Creative Director - Private World Communciations
cmv <email protected> http://www.privateworld.com
ICQ: 11386088
Something funny goes here.
-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.tryc.on.ca/php3.html
- Next message: sean <email protected>: "Re: [PHP3] [OFF TOPIC] FrontPage woes..."
- Previous message: Marcus Johansson: "Re: [PHP3]"
- In reply to: Marcus Johansson: "Re: [PHP3]"
- Next in thread: Zeev Suraski: "Re: [PHP3]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

