RE: [PHP] how call a variable in a text

2009-10-22 Thread Samrat Kar
, October 22, 2009 2:25 AM To: a...@ashleysheridan.co.uk Cc: David Murphy; php-general@lists.php.net Subject: Re: [PHP] how call a variable in a text Ashley Sheridan wrote on 2009-10-21 22:43: The {} only become really useful when you're trying to reference arrays within a string: $var = array

Re: [PHP] how call a variable in a text

2009-10-22 Thread Thodoris
On Wed, 2009-10-21 at 23:11 +0200, Kim Madsen wrote: Ashley Sheridan wrote on 2009-10-21 22:56: Try this though: ?php $var = array(array('great','alright'), 'boring'); print This is $var[0][0].; Print This is different from your previous example :-); -- Kind regards Kim

Re: [PHP] how call a variable in a text

2009-10-22 Thread Ashley Sheridan
On Thu, 2009-10-22 at 09:53 +0300, Thodoris wrote: On Wed, 2009-10-21 at 23:11 +0200, Kim Madsen wrote: Ashley Sheridan wrote on 2009-10-21 22:56: Try this though: ?php $var = array(array('great','alright'), 'boring'); print This is $var[0][0].; Print

RE: [PHP] how call a variable in a text

2009-10-22 Thread Andrea Giammarchi
: Kim Madsen [mailto:php@emax.dk] Sent: Thursday, October 22, 2009 2:25 AM To: a...@ashleysheridan.co.uk Cc: David Murphy; php-general@lists.php.net Subject: Re: [PHP] how call a variable in a text Ashley Sheridan wrote on 2009-10-21 22:43: The {} only become really useful when you're

Re: [PHP] how call a variable in a text

2009-10-22 Thread Thodoris
Erm, the braces are meant to go *around* the variable, not around a bit of it: print Test: {$var[0][0]}; Thanks, Ash http://www.ashleysheridan.co.uk In many cases braces can go around the variable name not the necessarily around the whole variable (like the bash scripts). Those are

RE: [PHP] how call a variable in a text

2009-10-22 Thread Andrea Giammarchi
Erm, the braces are meant to go *around* the variable, not around a bit of it: print Test: {$var[0][0]}; unrelated, just another usage of curly brackets $_ = 'abc'; $i = 0; echo $_{++$i}; // b Regards

RE: [PHP] how call a variable in a text

2009-10-22 Thread Andrea Giammarchi
So no they are not meant to go around. You can use them this way as well. that has almost the same meaning of $_ = '_POST'; echo count($$_); which again, for readability brackets are suggested to improve maintainability $_ = '_POST'; echo count(${$_}); Regards

Re: [PHP] how call a variable in a text

2009-10-22 Thread Thodoris
So no they are not meant to go around. You can use them this way as well. that has almost the same meaning of $_ = '_POST'; echo count($$_); which again, for readability brackets are suggested to improve maintainability $_ = '_POST'; echo count(${$_}); Regards

Re: [PHP] how call a variable in a text

2009-10-22 Thread Thodoris
Using the same type way as before in this thread. This was supposed to come out as using the same way of thinking. But the English-Nerdish dictionary came out... -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] how call a variable in a text

2009-10-22 Thread Andrea Giammarchi
I don't think it is about readability: $arr[3] = 'test'; $test = 3; //This prints $test echo This doesn't work: $$arr[3]; //This prints 3 echo This works: ${$arr[3]}; Using the same type way as before in this thread. Above example is a classic one where readability and

Re: [PHP] how call a variable in a text

2009-10-22 Thread Thodoris
I don't think it is about readability: $arr[3] = 'test'; $test = 3; //This prints $test echo This doesn't work: $$arr[3]; //This prints 3 echo This works: ${$arr[3]}; Using the same type way as before in this thread. Above example is a classic one where readability and

Re: [PHP] how call a variable in a text

2009-10-22 Thread Martin Scotta
On Thu, Oct 22, 2009 at 8:40 AM, Thodoris t...@kinetix.gr wrote: I don't think it is about readability: $arr[3] = 'test'; $test = 3; //This prints $test echo This doesn't work: $$arr[3]; //This prints 3 echo This works: ${$arr[3]}; Using the same type way as before in this thread.

Re: [PHP] how call a variable in a text

2009-10-21 Thread Andrew Ballard
2009/10/21 Bulend Kolay bma...@ihlas.net.tr: I 'll send a mail in html form using php5. cat send.php ?php $variable=date1 ; .. .. $message=' b There is a text $variable  trial. /b '; mail($to, $subject, $message, $headers) ; ? when I run send.php, I get the mail. But I can't call

RE: [PHP] how call a variable in a text

2009-10-21 Thread David Murphy
- From: Andrew Ballard [mailto:aball...@gmail.com] Sent: Wednesday, October 21, 2009 3:23 PM To: Bulend Kolay Cc: php-general@lists.php.net Subject: Re: [PHP] how call a variable in a text 2009/10/21 Bulend Kolay bma...@ihlas.net.tr: I 'll send a mail in html form using php5. cat send.php ?php

RE: [PHP] how call a variable in a text

2009-10-21 Thread Ashley Sheridan
type functions also. David -Original Message- From: Andrew Ballard [mailto:aball...@gmail.com] Sent: Wednesday, October 21, 2009 3:23 PM To: Bulend Kolay Cc: php-general@lists.php.net Subject: Re: [PHP] how call a variable in a text 2009/10/21 Bulend Kolay bma...@ihlas.net.tr

RE: [PHP] how call a variable in a text

2009-10-21 Thread David Murphy
@lists.php.net Subject: RE: [PHP] how call a variable in a text On Wed, 2009-10-21 at 15:40 -0500, David Murphy wrote: This is actually much better the { and } make it very obvious where the variable is and also it can keep odd issues from occurring sometimes. $message=b

Re: [PHP] how call a variable in a text

2009-10-21 Thread Kim Madsen
Ashley Sheridan wrote on 2009-10-21 22:43: The {} only become really useful when you're trying to reference arrays within a string: $var = array('great', 'boring'); $text = this is {$var[0]}.; Without the curly braces, PHP wouldn't be able to figure out whether you wanted the end string to

RE: [PHP] how call a variable in a text

2009-10-21 Thread Ashley Sheridan
...@ashleysheridan.co.uk] Sent: Wednesday, October 21, 2009 3:43 PM To: David Murphy Cc: php-general@lists.php.net Subject: RE: [PHP] how call a variable in a text On Wed, 2009-10-21 at 15:40 -0500, David Murphy wrote: This is actually much better the { and } make it very obvious where

Re: [PHP] how call a variable in a text

2009-10-21 Thread Ashley Sheridan
On Wed, 2009-10-21 at 22:54 +0200, Kim Madsen wrote: Ashley Sheridan wrote on 2009-10-21 22:43: The {} only become really useful when you're trying to reference arrays within a string: $var = array('great', 'boring'); $text = this is {$var[0]}.; Without the curly braces, PHP

Re: [PHP] how call a variable in a text

2009-10-21 Thread Kim Madsen
Ashley Sheridan wrote on 2009-10-21 22:56: Try this though: ?php $var = array(array('great','alright'), 'boring'); print This is $var[0][0].; Print This is different from your previous example :-); -- Kind regards Kim Emax - masterminds.dk -- PHP General Mailing List

Re: [PHP] how call a variable in a text

2009-10-21 Thread Ashley Sheridan
On Wed, 2009-10-21 at 23:11 +0200, Kim Madsen wrote: Ashley Sheridan wrote on 2009-10-21 22:56: Try this though: ?php $var = array(array('great','alright'), 'boring'); print This is $var[0][0].; Print This is different from your previous example :-); -- Kind regards

Re: [PHP] how call a variable in a text

2009-10-21 Thread Shawn McKenzie
Ashley Sheridan wrote: On Wed, 2009-10-21 at 22:54 +0200, Kim Madsen wrote: Ashley Sheridan wrote on 2009-10-21 22:43: The {} only become really useful when you're trying to reference arrays within a string: $var = array('great', 'boring'); $text = this is {$var[0]}.; Without the