3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $permalink = 'permalink'; $text_link = 'text_link'; $links = array( '<li><a>total</a></li>', '<li><a href="permalink">permalink</a></li>', '<li><a href="permalink">permalink</a></li>', ); $total = count($links); for($permalink=1; $permalink<=$total ;$permalink++){ $links[] = preg_replace('|<a>'.$total.'</a>|', '<a>'.$text_link.'</a>', $links); } print_r($links);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Array to string conversion in /in/4UsSn on line 13 Notice: Array to string conversion in /in/4UsSn on line 13 Notice: Array to string conversion in /in/4UsSn on line 13 Array ( [0] => <li><a>total</a></li> [1] => <li><a href="permalink">permalink</a></li> [2] => <li><a href="permalink">permalink</a></li> [3] => Array ( [0] => <li><a>total</a></li> [1] => <li><a href="permalink">permalink</a></li> [2] => <li><a href="permalink">permalink</a></li> ) [4] => Array ( [0] => <li><a>total</a></li> [1] => <li><a href="permalink">permalink</a></li> [2] => <li><a href="permalink">permalink</a></li> [3] => Array ) [5] => Array ( [0] => <li><a>total</a></li> [1] => <li><a href="permalink">permalink</a></li> [2] => <li><a href="permalink">permalink</a></li> [3] => Array [4] => Array ) )