3v4l.org

run code in 300+ PHP versions simultaneously
<?php $сolours = 'белый, сиреневый, розовый'; $arr_сolours = explode(",", $сolours); foreach ($arr_сolours as $сolour) { $product_сolour = trim($сolour); if ($product_сolour == 'белый') { $сolour1 = '#fff'; } elseif ($product_сolour == 'сиреневый') { $сolour2 = '#C769B5'; } elseif ($product_сolour == 'розовый') { $сolour3 = '#F2BDCC'; } } if (isset($сolour1)) { $сolour1 = $сolour1; } else { $сolour1 = false; } if (isset($сolour2)) { $сolour2 = $сolour2; } else { $сolour2 = false; } if (isset($сolour3)) { $сolour3 = $сolour3; } else { $сolour3 = false; } $сolour = [ $сolour1, $сolour2, $сolour3 ]; echo "--строка--\r"; print_r($сolours); echo "\r\r--массив в HEX--\r"; var_dump($сolour);
Output for git.master, git.master_jit, rfc.property-hooks
--строка-- белый, сиреневый, розовый --массив в HEX-- array(3) { [0]=> string(4) "#fff" [1]=> string(7) "#C769B5" [2]=> string(7) "#F2BDCC" }

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:
45.38 ms | 2605 KiB | 4 Q