Re: AW: AW: [PHP-DEV] dropping curly braces
| From: | Ian P. Christian | Date: | Sun, 20 Nov 2005 23:06:32 +0000 |
| Subject: | Re: AW: AW: [PHP-DEV] dropping curly braces | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-20210@lists.php.net to get a copy of this message | ||
On Sunday 20 November 2005 22:27, Ian P. Christian wrote:
> If this change included a simple sed command that could be applied to code
> to fix 'legacy' code
Sorry, should have included this...
For example:
$ cat test
<?php
$moo{3};
$foo = $moo{12};
?>
$ sed -e 's/$\([a-zA-Z][a-zA-Z0-9]*\){\([0-9]*\)}/substr($\1,\2,1)/g' test
<?php
substr($moo,3,1);
$foo = substr($moo,12,1);
?>
--
Ian P. Christian ~ http://pookey.co.uk
Attachment: [application/pgp-signature]
Attachment: [application/pgp-signature]