3v4l.org

run code in 300+ PHP versions simultaneously
<?php function startsWith($haystack, $needle) { // search backwards starting from haystack length characters from the end return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE; } $session = array( 'current_page_12' => 'abc', 'current_page_qw1' => 'xyz', 'hello' => 'world', 'current_page_23d' => 'mno', 'example' => '112' ); foreach($session as $key => $value) { if(startsWith($key, 'current_page_')) unset($session[$key]); } print_r($session);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [hello] => world [example] => 112 )

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:
145.45 ms | 405 KiB | 5 Q