3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'tableData' => [ [ 'booking_name' => 'abc/xyz/123', 'pdg' => 'assure', 'user_area' => 'es st', 'release' => 'oss72', 'start_date' => '2017-06-20 00:00:00', 'end_date' => '2017-06-23 00:00:00', 'asset_info' => [ [ 'status' => 10, 'manufacturer' => 'HP', 'model' => 'HP BL460C GEN8', 'hardware_color' => ''#0066b3' ] ], 'full_name' => 'Valay Desai', 'email_address' => 'valay@xyz.com' ], [ 'booking_name' => 'abc/xyz/123', 'pdg' => 'assure', 'user_area' => 'ls reca', 'release' => 'oss72', 'start_date' => '2017-06-20 00:00:00', 'end_date' => '2017-06-23 00:00:00', 'asset_info' => [ [ 'status' => 10, 'manufacturer' => 'SUN', 'model' => 'SUN GEN8', 'hardware_color' => '#0066b3' ] ], 'full_name' => 'Chako Desai', 'email_address' => 'chako@xyz.com' ] ] ]; $filterBy = [ 'booking_name' => 'abc', 'pdg' => [ ['name' => 'Invalid', 'value' => 'Invalid'], ['name' => 'assure', 'value' => 'assure'] ], 'user_area' => [ ['name' => 'es st', 'value' => 'es st'], ['name' => 'Invalid', 'value' => 'Invalid'], ['name' => 'a&o', 'value' => 'a&o'] ] ]; // simplify structure $filterBy['pdg'] = array_column($filterBy['pdg'], 'value'); $filterBy['user_area'] = array_column($filterBy['user_area'], 'value'); var_export( [ 'tableData' => array_filter( $array['tableData'], function($row) use($filterBy) { return str_contains($row['booking_name'], $filterBy['booking_name']) && in_array($row['pdg'], $filterBy['pdg']) && in_array($row['user_area'], $filterBy['user_area']); } ) ] );
Output for 8.0.1 - 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 - 8.5.1
array ( 'tableData' => array ( 0 => array ( 'booking_name' => 'abc/xyz/123', 'pdg' => 'assure', 'user_area' => 'es st', 'release' => 'oss72', 'start_date' => '2017-06-20 00:00:00', 'end_date' => '2017-06-23 00:00:00', 'asset_info' => array ( 0 => array ( 'status' => 10, 'manufacturer' => 'HP', 'model' => 'HP BL460C GEN8', 'hardware_color' => '', ), ), 'full_name' => 'Valay Desai', 'email_address' => 'valay@xyz.com', ), ), )
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.
Output for 7.4.0 - 7.4.33
Fatal error: Uncaught Error: Call to undefined function str_contains() in /in/4paXE:67 Stack trace: #0 [internal function]: {closure}(Array) #1 /in/4paXE(70): array_filter(Array, Object(Closure)) #2 {main} thrown in /in/4paXE on line 67
Process exited with code 255.

preferences:
160.26 ms | 409 KiB | 5 Q