3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $res = ''; $attributes = explode("||", 'черный==0||зеленый==0||салатовый==0||полированный==0||оранжевый==0||красный==0||белый==0'); $attributes1 = 'черный==0||зеленый==0||салатовый==0||полированный==0||оранжевый==0||красный==0||белый==0'; $tvs1=explode("||",$attributes1); foreach ($tvs1 as $value_attribute_delimiter) { $arr .= print_r(explode("==", $value_attribute_delimiter))[1]; //echo $value_attribute_delimiter.'-'; foreach (explode("==", $value_attribute_delimiter) as $value) { //echo $value; } } echo $arr;
based on Q4f7u
Output for 5.4.0 - 7.3.1
Array ( [0] => черный [1] => 0 ) Notice: Undefined variable: arr in /in/dis6a on line 13 Array ( [0] => зеленый [1] => 0 ) Array ( [0] => салатовый [1] => 0 ) Array ( [0] => полированный [1] => 0 ) Array ( [0] => оранжевый [1] => 0 ) Array ( [0] => красный [1] => 0 ) Array ( [0] => белый [1] => 0 )
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/dis6a on line 13
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/dis6a on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/dis6a on line 13
Process exited with code 255.