3v4l.org

run code in 300+ PHP versions simultaneously
<?php $notifications = [ ['score'=>120,'type'=>5,'post_id'=>1,'subject'=>'a subject','range_day'=>'today'], ['score'=>6,'type'=>4,'post_id'=>2,'subject'=>'a subject','range_day'=>'today'], ['score'=>2,'type'=>4,'post_id'=>3,'subject'=>'a subject','range_day'=>'yesterday'], ]; $template = <<< 'TXT' <li> <p class="subject">{{subject}}<span> | type:{{type}}</span></p> <div class="score">Your score: {{score}}</div> <a href="/{{post_id}}/{{no_space_subject}}"> <span class="date">{{range_day}}</span> </li> TXT; $links = ''; foreach ($notifications as $n){ $n['no_space_subject'] = str_replace(' ','-',$n['subject']); //replace {{VALUE}} with $n[VALUE] in the template. append result //to $links $links .= preg_replace_callback('/{{([^}]+)}}/s', function($m) use ($n){return $n[$m[1]];}, $template ); } echo "<u>$links</u>";
Output for git.master, git.master_jit, rfc.property-hooks
<u><li> <p class="subject">a subject<span> | type:5</span></p> <div class="score">Your score: 120</div> <a href="/1/a-subject"> <span class="date">today</span> </li><li> <p class="subject">a subject<span> | type:4</span></p> <div class="score">Your score: 6</div> <a href="/2/a-subject"> <span class="date">today</span> </li><li> <p class="subject">a subject<span> | type:4</span></p> <div class="score">Your score: 2</div> <a href="/3/a-subject"> <span class="date">yesterday</span> </li></u>

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
32.61 ms | 402 KiB | 8 Q