codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php $array = array( 0 => '[This is a line of text', 1 => 'and another', 2 => 'and yet another.] [This is another line of text', 3 => 'and another', 4 => 'and another] [OK, so you get the idea.', ); for($i = 0; $i < count($array); $i++) { $array[$i] = '<p>'.$array[$i].'</p>'; $array[$i] = preg_replace('/\]/', '</p>', $array[$i]); $array[$i] = preg_replace('/\[/', '<p class="myclass">', $array[$i]); $array[$i] = preg_replace('/<p><p/', '<p', $array[$i]); } echo "<pre>"; var_dump($array); ?>
Private
[
?
]
Run code
Submit