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 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

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 mainta

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 readabil

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 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 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 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 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 co

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

2009-10-22 Thread Andrea Giammarchi
> Subject: RE: [PHP] how call a variable in a text > > This is always safe to use variables like this... > > $text = "This is " . $variable; > > Or > > $text = "This is " . $variable[0]; > > Regards, > > Samrat Kar >

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: > >>> > >>> >>> > >>> $var = array(array('great','alright'), 'boring'); > >>> > >>> print "T

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

2009-10-21 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: Print "This is different from your previous example :-)"; -- Kind regards Kim Emax - masterminds.dk Yeah, I just forgot that PHP will correctly work wit

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

2009-10-21 Thread Samrat Kar
.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 trying to reference arrays

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[

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: > > > > > > > $var = array(array('great','alright'), 'boring'); > > > > print "This is $var[0][0]."; > > Print "This is different from your previous example :-)"; > > --

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: Print "This is different from your previous example :-)"; -- Kind regards Kim Emax - masterminds.dk -- 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-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 th

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

2009-10-21 Thread Ashley Sheridan
t, everyone has their own prefs. > > > > David > > > > > From: Ashley Sheridan [mailto:a...@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

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 David Murphy
ral@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=&quo

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

2009-10-21 Thread Ashley Sheridan
; > > There is always sprint 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]

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

2009-10-21 Thread David Murphy
al 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 : > I 'll send a mail in html form using php5. > > cat send

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

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