3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "5,1"; $base = array('1'=>'Bread','5'=>'Butter'); $flipped = array_flip( explode(',', $str)); print_r( $flipped); $intersection = array_intersect_key( array_merge( $base, $flipped), $base); print_r( $intersection); $replacements = array_values( $intersection); print_r( $replacements);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [5] => 0 [1] => 1 ) Array ( [1] => Butter ) Array ( [0] => Butter )

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:
44.34 ms | 401 KiB | 8 Q