Ian P. Christian wrote:

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);

?>
Doesn't work to well with

$$moo{1};

or

$moo = array( 1 => 'foo');
$moo{1};

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to