note 58607 added to function.mb-convert-variables
| From: | ingrid at osu1 dot php dot net | Date: | Wed, 09 Nov 2005 14:28:49 +0000 |
| Subject: | note 58607 added to function.mb-convert-variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-98330@lists.php.net to get a copy of this message | ||
I have downloaded a script, that looks like it has been written for php3.
The php manual says most php3 scripts should work on php4
but some may need adaptation:
http://livedocs.phpdoc.info/index.php?l=en&q=migration4#
says:
"
PHP 4 adds a new mechanism to variable substitution in strings.
You can now finally access object member variables and elements
from multidimensional arrays within strings.
To do so you have to enclose your variables with curly braces
with the dollar sign immediately following the opening brace: {$...}
To embed the value of an object member variable into a string
you simply write "text {$obj->member} text"
while in PHP 3 you had to use something like
"text ".$obj->member." text".
This should lead to more readable code,
while it may break existing scripts written for PHP 3.
But you can easily check for this kind of problem by checking for
the character combination {$ in your code
and by replacing it with \{$ with your favorite search-and-replace tool.
"
....................................................................
Now, this looks like arabic to me:
How can replacement of {$ by \{$ result in
"text {$obj->member} text"
where originally was written
"text ".$obj->member." text"
?????????
Im I stupid, or should I NOT take the official PHP manual on its words?
In my downloaded script I find coding like:
......................................................................
$this->db_date = $this->year.$this->month.$this->day;
$this->de_date = $this->day.".".$this->month.".".$this->year;
$this->us_date = $this->month."/".$this->day."/".$this->year;
if ($this->error) return (1);
......................................................................
Should I run the find and replace like the PHP manual suggests,
nothing will be changed.
But probably I should replace things like
......................................................................
$this->year.$this->month.$this->day;
......................................................................
by
......................................................................
{$this->year} {$this->month} {$this->day};
......................................................................
-??????????????????-
A reply would be very appreciated.
----
Manual Page -- http://www.php.net/manual/en/function.mb-convert-variables.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58607
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58607&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58607&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58607&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58607&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58607&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58607&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58607&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58607&report=yes
Search -- http://master.php.net/manage/user-notes.php