php-general Digest 22 Oct 2009 05:59:45 -0000 Issue 6403
Topics (messages 299157 through 299180):
Re: How to pronounce PHP code over the phone?
299157 by: tedd
299163 by: Daevid Vincent
Re: Sanitizing potential MySQL strings with no database connection
299158 by: Jim Lucas
299159 by: Dotan Cohen
299160 by: Dotan Cohen
299161 by: Jim Lucas
Text File Busy
299162 by: Floyd Resler
299165 by: Shawn McKenzie
how call a variable in a text
299164 by: Bulend Kolay
299166 by: Andrew Ballard
299167 by: Shawn McKenzie
299168 by: David Murphy
299169 by: Ashley Sheridan
299170 by: David Murphy
299171 by: Kim Madsen
299172 by: Ashley Sheridan
299173 by: Ashley Sheridan
299174 by: Kim Madsen
299175 by: Ashley Sheridan
299176 by: Shawn McKenzie
299180 by: Samrat Kar
Web Service Server in PHP
299177 by: Daniel Echalar
299178 by: Eddie Drapkin
299179 by: Dan McCullough
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
At 9:42 AM +0200 10/21/09, Dotan Cohen wrote:
> Open paren. Dollar-sign "item" de-ref getServiceID method. Question mark.
Dollar-sign "item" de-ref getServiceID method again. Colon.
Dollar-sign "item" de-ref getID method. Close up matching parenthesis.
> http://en.wikipedia.org/wiki/Reference_%28computer_science%29
Thanks. The word Reference was what was missing, as was the term "de-ref".
Read a bit further down in the above link, namely the php link, which is:
http://www.php.net/manual/en/language.variables.variable.php
Using the term "de-ref is not complete and could be misleading --
dereferencing a variable in php is simply $$var and not ->var.
The "arrow operator" ($a->$b) dereferences the element to its left
and accesses the member to it's right. If you want an example in C it
would be (*a).b
While I was not able to find the "official" name for the operator,
but it could be called an "dereference access operator" or the "field
access operator".
HTH's
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: tedd [mailto:tedd.sperl...@gmail.com]
> Sent: Wednesday, October 21, 2009 7:38 AM
> To: Dotan Cohen; Daevid Vincent
> Cc: php-general.
> Subject: Re: [PHP] How to pronounce PHP code over the phone?
>
> At 9:42 AM +0200 10/21/09, Dotan Cohen wrote:
> > > Open paren. Dollar-sign "item" de-ref getServiceID
> method. Question mark.
> >> Dollar-sign "item" de-ref getServiceID method again. Colon.
> >> Dollar-sign "item" de-ref getID method. Close up matching
> parenthesis.
> >>
> > > http://en.wikipedia.org/wiki/Reference_%28computer_science%29
> >>
> >
> >Thanks. The word Reference was what was missing, as was the
> term "de-ref".
>
> Read a bit further down in the above link, namely the php
> link, which is:
>
> http://www.php.net/manual/en/language.variables.variable.php
>
> Using the term "de-ref is not complete and could be misleading --
> dereferencing a variable in php is simply $$var and not ->var.
>
> The "arrow operator" ($a->$b) dereferences the element to its left
> and accesses the member to it's right. If you want an example in C it
> would be (*a).b
>
> While I was not able to find the "official" name for the operator,
> but it could be called an "dereference access operator" or the "field
> access operator".
Well, if I were talking to a fellow PHPriend, I probalby wouldn't even use
the word "de-ref" as I would assume that they would know (some basics in
that) if I say, " 'item's getServiceID method " that 'item' is an object and
therefore must be prefixed with a dollar sign ($) and that to make a
'getServiceID' method, it requires the -> arrow as well as the ending
parenthesis.
But I think for the OP's purposes, he could simply DEFINE any word he wanted
at the beginning of the conversation: "Listen up duder. When I say 'de-ref'
you make hyphen and a greater-than sign. Capiche?". He could just as easily
say, "Listen up duder. When I say 'arrow-thingy' you make hyphen and a
greater-than sign. Capiche?" Problem solved. ;-)
--- End Message ---
--- Begin Message ---
Jim Lucas wrote:
> Dotan Cohen wrote:
>>> So, actually taking a minute to read up on addcslashes(), it is a
>>> rather handy
>>> little function.
>>>
>>> Taking the list of characters that mysql_real_escape_string() says it
>>> escapes:
>>>
>>> http://us3.php.net/mysql_real_escape_string
>>>
>>> Which it lists: \x00, \n, \r, \, ', " and \x1a
>>>
>>> \0 = \x0
>>> \10 = \n
>>> \13 = \r
>>> \92 = \
>>> \44 = '
>>> \34 = "
>>> \26 = \x1a
>>>
>>> You could do something like this.
>>>
>>> function cleaner($input) {
>>> return addcslashes($input, "\0\10\13\92\44\34\26");
>>> }
>>>
>>> Maybe this will help...
>>>
>>> Jim
>>>
>>
>> So far as I understand mysql_real_escape_string() was invented because
>> addslashes() is not adequate.
>>
>>
>
> If you look a little closer, you will see that I am not using
> addslashes(). Rather, I am using addcslashes(). This allows to specify
> the characters that I want escaped, instead of the default assumed
> characters from addslashes().
>
Thinking a little deeper here, you say you are concerned about the character
type, yet you say that it is all assumed UTF-8. Is everything going to be UTF-8
or something else?
If it is all going to be UTF-8, then the addcslashes() variation above will
work.
--- End Message ---
--- Begin Message ---
> If you look a little closer, you will see that I am not using addslashes().
> Rather, I am using addcslashes(). This allows to specify the characters
> that I want escaped, instead of the default assumed characters from
> addslashes().
>
I do not know which characters to escape.
--
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il
--- End Message ---
--- Begin Message ---
> Thinking a little deeper here, you say you are concerned about the character
> type, yet you say that it is all assumed UTF-8. Is everything going to be
> UTF-8
> or something else?
>
> If it is all going to be UTF-8, then the addcslashes() variation above will
> work.
>
It _should_ all be UTF-8 but I suppose that it is possible for someone
to spoof a non-UTF-8 POST request. I do not want to take the
development of a secure function into my own hands.
--
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il
--- End Message ---
--- Begin Message ---
Dotan Cohen wrote:
>> If you look a little closer, you will see that I am not using addslashes().
>> Rather, I am using addcslashes(). This allows to specify the characters
>> that I want escaped, instead of the default assumed characters from
>> addslashes().
>>
>
> I do not know which characters to escape.
>
I have given you the link to the mysql_real_escape_string(). On that page, it
shows the characters that it escapes.
--- End Message ---
--- Begin Message ---
For some reason I'm getting a Text file busy error when I try to
execute PHP scripts from the command line now. It used to work, but
now it doesn't. I do have #!/usr/bin/php at the top of my script. If
I feed the file to php (i.e. /usr/bin/php -f filename.php) it works.
Of course, I can use this method but I was curious if anyone else has
had similar problems and what the solution was. I'm guessing that
something I installed is messing it up.
Thanks!
Floyd
--- End Message ---
--- Begin Message ---
Floyd Resler wrote:
> For some reason I'm getting a Text file busy error when I try to execute
> PHP scripts from the command line now. It used to work, but now it
> doesn't. I do have #!/usr/bin/php at the top of my script. If I feed
> the file to php (i.e. /usr/bin/php -f filename.php) it works. Of
> course, I can use this method but I was curious if anyone else has had
> similar problems and what the solution was. I'm guessing that something
> I installed is messing it up.
>
> Thanks!
> Floyd
>
The file is open somewhere most likely. Try: lsof | grep filename.php
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
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 variable called
variable. it comes as string.
How can I correct this?
--- End Message ---
--- Begin Message ---
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 variable called
> variable. it comes as string.
> How can I correct this?
>
You need to use double quotes (or HEREDOC) if you want PHP to replace
$variable with its value in the string:
$message="
<b> There is a text $variable trial. </b>
";
or
$message = <<<MESSAGE
<b> There is a text $variable trial. </b>
MESSAGE;
Andrew
--- End Message ---
--- Begin Message ---
Bulend Kolay wrote:
> 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 variable called
> variable. it comes as string.
> How can I correct this?
http://us2.php.net/manual/en/language.types.string.php
$message= "<b> There is a text $variable trial. </b>";
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
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> There is a text {$variable} trial. </b> ";
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-gene...@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
> $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 variable called
> variable. it comes as string.
> How can I correct this?
>
You need to use double quotes (or HEREDOC) if you want PHP to replace $variable
with its value in the string:
$message="
<b> There is a text $variable trial. </b> ";
or
$message = <<<MESSAGE
<b> There is a text $variable trial. </b> MESSAGE;
Andrew
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
No virus found in this outgoing message.
Checked by AVG - www.avg.com
Version: 8.5.423 / Virus Database: 270.14.24/2449 - Release Date: 10/20/09
18:42:00
--- End Message ---
--- Begin Message ---
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> There is a text {$variable} trial. </b> ";
>
> 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-gene...@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
> > $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 variable called
> > variable. it comes as string.
> > How can I correct this?
> >
>
> You need to use double quotes (or HEREDOC) if you want PHP to replace
> $variable with its value in the string:
>
> $message="
>
> <b> There is a text $variable trial. </b> ";
>
> or
>
> $message = <<<MESSAGE
>
> <b> There is a text $variable trial. </b> MESSAGE;
>
>
>
> Andrew
>
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
> No virus found in this outgoing message.
> Checked by AVG - www.avg.com
> Version: 8.5.423 / Virus Database: 270.14.24/2449 - Release Date: 10/20/09
> 18:42:00
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
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 be 'This is great.' or 'This is [0].' despite
the variable itself clearly being an array.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
True however K.I.S.S would say , if you can use it like
echo “This is a statement {$Blah}.”;
echo “This is also a statement {$objBlah->BlahString}.”;
echo “This is also a statement {$tBlah[‘BlahKey’]}.”;
You should do it so you are always using the same expected format, cleaner for
readability and training other people to understand how you code.
This is my personal thoughts on it, 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-gene...@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> There is a text {$variable} trial. </b> ";
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-gene...@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
> $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 variable called
> variable. it comes as string.
> How can I correct this?
>
You need to use double quotes (or HEREDOC) if you want PHP to replace $variable
with its value in the string:
$message="
<b> There is a text $variable trial. </b> ";
or
$message = <<<MESSAGE
<b> There is a text $variable trial. </b> MESSAGE;
Andrew
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
No virus found in this outgoing message.
Checked by AVG - www.avg.com
Version: 8.5.423 / Virus Database: 270.14.24/2449 - Release Date: 10/20/09
18:42:00
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
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 be 'This is great.' or 'This is [0].' despite the variable
itself clearly being an array.
Thanks,
Ash
http://www.ashleysheridan.co.uk
No virus found in this outgoing message.
Checked by AVG - www.avg.com
Version: 8.5.423 / Virus Database: 270.14.24/2449 - Release Date: 10/20/09
18:42:00
--- End Message ---
--- Begin Message ---
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 be 'This is great.' or 'This is [0].' despite
the variable itself clearly being an array.
Ehh what? This has never been a problem for me:
$text = "this is $var[0].";
However this does give an error (or notice, don't recall, haven't seen
the error in quite a while):
$text = "this is $var['0'].";
In that case the solution is the curly brackets:
$text = "this is {$var['0']}.";
--
Kind regards
Kim Emax - masterminds.dk
--- End Message ---
--- Begin Message ---
On Wed, 2009-10-21 at 15:51 -0500, David Murphy wrote:
> True however K.I.S.S would say , if you can use it like
>
>
>
>
>
> echo “This is a statement {$Blah}.”;
>
> echo “This is also a statement {$objBlah->BlahString}.”;
>
> echo “This is also a statement {$tBlah[‘BlahKey’]}.”;
>
>
>
>
>
> You should do it so you are always using the same expected format,
> cleaner for readability and training other people to understand how
> you code.
>
>
>
>
>
> This is my personal thoughts on it, 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-gene...@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> There is a text {$variable} trial. </b> ";
>
> 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-gene...@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
> > $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 variable called
> > variable. it comes as string.
> > How can I correct this?
> >
>
> You need to use double quotes (or HEREDOC) if you want PHP to replace
> $variable with its value in the string:
>
> $message="
>
> <b> There is a text $variable trial. </b> ";
>
> or
>
> $message = <<<MESSAGE
>
> <b> There is a text $variable trial. </b> MESSAGE;
>
>
>
> Andrew
>
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
> No virus found in this outgoing message.
> Checked by AVG - www.avg.com
> Version: 8.5.423 / Virus Database: 270.14.24/2449 - Release Date: 10/20/09
> 18:42:00
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> 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 be 'This is great.' or 'This is [0].'
> despite the variable itself clearly being an array.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
>
>
>
>
>
>
> No virus found in this outgoing message.
> Checked by AVG - www.avg.com
> Version: 8.5.423 / Virus Database: 270.14.24/2449 - Release Date: 10/20/09
> 18:42:00
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
I reckon that part is all down to personal preference. Interesting to
see it works on objects too though. I've not seen that before, I was
always breaking outside of the strings for that type of thing.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
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 wouldn't be able to figure out whether you
> > wanted the end string to be 'This is great.' or 'This is [0].' despite
> > the variable itself clearly being an array.
>
> Ehh what? This has never been a problem for me:
>
> $text = "this is $var[0].";
>
> However this does give an error (or notice, don't recall, haven't seen
> the error in quite a while):
>
> $text = "this is $var['0'].";
>
> In that case the solution is the curly brackets:
>
> $text = "this is {$var['0']}.";
>
> --
> Kind regards
> Kim Emax - masterminds.dk
>
Try this though:
<?php
$var = array(array('great','alright'), 'boring');
print "This is $var[0][0].";
?>
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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 Emax - masterminds.dk
>
Yeah, I just forgot that PHP will correctly work with an array to a
depth of 1 inside of a string. Much like the above advice, I'd taken to
always using {} for arrays inside of strings, although not for strings
inside of strings unless I needed non-white-space text to immediately
follow said string. Would make more sense if I used the braces for
everything, but nobody has ever accused me of making too much sense
before!
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
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 curly braces, PHP wouldn't be able to figure out whether you
>>> wanted the end string to be 'This is great.' or 'This is [0].' despite
>>> the variable itself clearly being an array.
>> Ehh what? This has never been a problem for me:
>>
>> $text = "this is $var[0].";
>>
>> However this does give an error (or notice, don't recall, haven't seen
>> the error in quite a while):
>>
>> $text = "this is $var['0'].";
>>
>> In that case the solution is the curly brackets:
>>
>> $text = "this is {$var['0']}.";
>>
>> --
>> Kind regards
>> Kim Emax - masterminds.dk
>>
>
> Try this though:
>
> <?php
>
> $var = array(array('great','alright'), 'boring');
>
> print "This is $var[0][0].";
>
> ?>
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
And since we are trying to cover all possible ways (works with double
quotes also):
$message = '<b> There is a text ' . $variable . ' trial. </b>';
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
This is always safe to use variables like this...
$text = "This is " . $variable;
Or
$text = "This is " . $variable[0];
Regards,
Samrat Kar
FRD, BARC
Tel: 022-25597295
Alternate Email: esam...@yahoo.com
-----Original Message-----
From: Kim Madsen [mailto:php....@emax.dk]
Sent: Thursday, October 22, 2009 2:25 AM
To: a...@ashleysheridan.co.uk
Cc: David Murphy; php-gene...@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('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 be 'This is great.' or 'This is [0].' despite
> the variable itself clearly being an array.
Ehh what? This has never been a problem for me:
$text = "this is $var[0].";
However this does give an error (or notice, don't recall, haven't seen
the error in quite a while):
$text = "this is $var['0'].";
In that case the solution is the curly brackets:
$text = "this is {$var['0']}.";
--
Kind regards
Kim Emax - masterminds.dk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.423 / Virus Database: 270.14.25/2450 - Release Date: 10/21/09
16:44:00
--- End Message ---
--- Begin Message ---
Hi,
Does anybody knows a web services server based on PHP?
The only one a see is Nusoap, but even for this one i can't find the webpage
to see the documentation.
by the way, i'm trying to develop an application using web services in PHP,
any start point suggestion will be appreciated.
thanks for the anwers!
--- End Message ---
--- Begin Message ---
On Wed, Oct 21, 2009 at 9:26 PM, Daniel Echalar <dany...@gmail.com> wrote:
> Hi,
>
> Does anybody knows a web services server based on PHP?
>
> The only one a see is Nusoap, but even for this one i can't find the webpage
> to see the documentation.
>
> by the way, i'm trying to develop an application using web services in PHP,
> any start point suggestion will be appreciated.
>
> thanks for the anwers!
>
Nanoweb is an HTTP server: http://nanoweb.si.kz/
I'm pretty sure this is exactly what you're looking for.
--- End Message ---
--- Begin Message ---
I believe NuSoap is still available
source: http://sourceforge.net/projects/nusoap/
http://greghuet.blogspot.com/2007/12/soap-php5-and-nusoapphp.html
You can also look here at PHPs SOAP functions
http://php.net/manual/en/refs.webservice.php
On Wed, Oct 21, 2009 at 9:26 PM, Daniel Echalar <dany...@gmail.com> wrote:
> Hi,
>
> Does anybody knows a web services server based on PHP?
>
> The only one a see is Nusoap, but even for this one i can't find the
> webpage
> to see the documentation.
>
> by the way, i'm trying to develop an application using web services in PHP,
> any start point suggestion will be appreciated.
>
> thanks for the anwers!
>
--- End Message ---