note 91894 deleted from migration53.deprecated by danbrown
| From: | danbrown@php.net | Date: | Thu, 13 Aug 2009 02:36:56 +0000 |
| Subject: | note 91894 deleted from migration53.deprecated by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159426@lists.php.net to get a copy of this message | ||
Note Submitter: Chris at PureFormSolutions dot com
----
To find [and replace] string access offsets using {}, like:
<?php
$var = "abcd";
echo $var{1};
?>
I plugged this regex into my IDE [NuSphere]:
\$([a-zA-Z0-9_]+){([^}]+)}
... and put this as the replacement string:
$\1[\2]
This helped me find all the instances of this in my code, but it might not find all of them in
yours. It will ignore stuff like:
<?php
$var_1 = "abcd";
$i = 1;
echo ${'var_' . $i}{1}; # this will not be found by the regex above
?>