3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $permalink = 'permalink'; $text_link = 'text_link'; $links = array( '<li><a href="permalink">permalink1</a></li>', '<li><a href="permalink">permalink2</a></li>', '<li><a href="permalink">permalink3</a></li>', ); $total = count($links); for($links as $link){ $new_links[] = preg_replace('|<a[^>]*>'.$total.'</a>|', '<a>'.$text_link.'</a>', $link); } print_r($new_links);
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected 'as' (T_AS), expecting ';' in /in/0Q89W on line 12
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_AS, expecting ';' in /in/0Q89W on line 12
Process exited with code 255.