3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_POST['site'] = [1, 2, 3, '4foo', '5bar']; $sites = array_map(function ($val) { return filter_var($val, FILTER_SANITIZE_NUMBER_INT); }, $_POST['site']); print_r($sites);
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.32, 8.0.0 - 8.0.24, 8.1.0 - 8.1.11
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 )

preferences:
56.78 ms | 410 KiB | 5 Q