3v4l.org

run code in 300+ PHP versions simultaneously
<?php $old = 'james,john,mark,luke,'; $users = 'james,john,mark,luke,mary,david'; $old_items = explode(',', $old); $users_items = explode(',', $users); echo implode(array_diff($users_items, $old_items), ',');
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /in/tnt9F:8 Stack trace: #0 /in/tnt9F(8): implode(Array, ',') #1 {main} thrown in /in/tnt9F on line 8
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/tnt9F on line 8 mary,david
Output for 5.5.0 - 5.5.36, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.5 - 7.2.33, 7.3.16 - 7.3.33
mary,david

preferences:
183.99 ms | 402 KiB | 211 Q