3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ '.ws_config', 'Akms-wpp-all-vars.cfg', 'makes-lop-use-vars.cfg', '.ptp-sync/ASERD_EDITMSG', '.ptp-sync/index', '.ptp-sync/hooks/apply_value', ]; $hidden = new class (new ArrayIterator($array)) extends FilterIterator { public function accept(): bool { return !str_starts_with($this->current(), '.ptp-sync/'); } }; $result = iterator_to_array($hidden, true); print_r($result);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.21, 8.5.0 - 8.5.7
Array ( [0] => .ws_config [1] => Akms-wpp-all-vars.cfg [2] => makes-lop-use-vars.cfg )
Output for 7.4.0 - 7.4.33
Fatal error: Uncaught Error: Call to undefined function str_starts_with() in /in/lQkMA:16 Stack trace: #0 [internal function]: class@anonymous->accept() #1 [internal function]: FilterIterator->rewind() #2 /in/lQkMA(20): iterator_to_array(Object(class@anonymous), true) #3 {main} thrown in /in/lQkMA on line 16
Process exited with code 255.

preferences:
82.23 ms | 1274 KiB | 4 Q