funnymoney
09-08-2009, 07:42 AM
I'm trying to fix this old BBCode script to work something better, but something just doesn't go right..
preg_match_all('/(\[php])(.+?)(\[\/php])/', stripslashes($tekst), $matches);
gives this results,
Array
(
[0] => Array
(
[0] => [php ]<?php echo 'hello world1'; ?>[/php ]
[1] => [php ]<?php echo 'hello world2'; ?>[/php ]
[2] => [php ]<?php echo 'hello world3'; ?>[/php ]
)
[1] => Array
(
[0] => [php ]
[1] => [php ]
[2] => [php ]
)
[2] => Array
(
[0] => <?php echo 'hello world1'; ?>
[1] => <?php echo 'hello world2'; ?>
[2] => <?php echo 'hello world3'; ?>
)
[3] => Array
(
[0] => [/php ]
[1] => [/php ]
[2] => [/php ]
)
)
and i would like to ommit [ php ] and [ /php ] from searches. i tried different regex but just can't figure it out..
preg_match_all('/(\[php])(.+?)(\[\/php])/', stripslashes($tekst), $matches);
gives this results,
Array
(
[0] => Array
(
[0] => [php ]<?php echo 'hello world1'; ?>[/php ]
[1] => [php ]<?php echo 'hello world2'; ?>[/php ]
[2] => [php ]<?php echo 'hello world3'; ?>[/php ]
)
[1] => Array
(
[0] => [php ]
[1] => [php ]
[2] => [php ]
)
[2] => Array
(
[0] => <?php echo 'hello world1'; ?>
[1] => <?php echo 'hello world2'; ?>
[2] => <?php echo 'hello world3'; ?>
)
[3] => Array
(
[0] => [/php ]
[1] => [/php ]
[2] => [/php ]
)
)
and i would like to ommit [ php ] and [ /php ] from searches. i tried different regex but just can't figure it out..