3v4l.org

run code in 300+ PHP versions simultaneously
<?php $attribute_content[0]['term_id'] = 76; $attribute_content[0]['content'] = "ratio"; $attribute_content[1]['term_id'] = 18; $attribute_content[1]['content'] = "ideal condition"; $attribute_content[2]['term_id'] = 164; $attribute_content[2]['content'] = "genotype"; $attribute_content[3]['term_id'] = 218; $attribute_content[3]['content'] = "genetics"; $attribute_content[4]['term_id'] = 60; $attribute_content[4]['content'] = "height"; $order = array(18,164,218,60,76); $weights = array_flip($order); usort($attribute_content, function($x, $y) use($weights) { return $weights[$x['term_id']] - $weights[$y['term_id']]; }); var_dump($attribute_content);
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
array(5) { [0]=> array(2) { ["term_id"]=> int(18) ["content"]=> string(15) "ideal condition" } [1]=> array(2) { ["term_id"]=> int(164) ["content"]=> string(8) "genotype" } [2]=> array(2) { ["term_id"]=> int(218) ["content"]=> string(8) "genetics" } [3]=> array(2) { ["term_id"]=> int(60) ["content"]=> string(6) "height" } [4]=> array(2) { ["term_id"]=> int(76) ["content"]=> string(5) "ratio" } }
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
173.34 ms | 408 KiB | 5 Q