3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'lo: 00:00:00:00:00:00 enp0s25: 00:21:cc:d4:2a:23 wlp3s0: 84:3a:4b:03:3c:3a wwp0s20u4: 7a:e3:2a:de:66:09 br-a02a0801833f: 02:42:75:b4:8b:58 docker0: 02:42:cb:f0:5f:0d'; preg_match_all('/([a-z0-9-]+):\s+((?:[0-9a-f]{2}:){5}[0-9a-f]{2})/i', $str, $matches); $output = array_combine($matches[1], $matches[2]); echo json_encode($output, JSON_PRETTY_PRINT);
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
{ "lo": "00:00:00:00:00:00", "enp0s25": "00:21:cc:d4:2a:23", "wlp3s0": "84:3a:4b:03:3c:3a", "wwp0s20u4": "7a:e3:2a:de:66:09", "br-a02a0801833f": "02:42:75:b4:8b:58", "docker0": "02:42:cb:f0:5f:0d" }
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 { "lo": "00:00:00:00:00:00", "enp0s25": "00:21:cc:d4:2a:23", "wlp3s0": "84:3a:4b:03:3c:3a", "wwp0s20u4": "7a:e3:2a:de:66:09", "br-a02a0801833f": "02:42:75:b4:8b:58", "docker0": "02:42:cb:f0:5f:0d" }

preferences:
150.75 ms | 402 KiB | 177 Q