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
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
> 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
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
> 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
--
> 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
> 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
__
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
> 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
>
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
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
.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
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[
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 :-)";
>
> --
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
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
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
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
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
;
>
> 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]
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
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
22 matches
Mail list logo