3v4l.org

run code in 300+ PHP versions simultaneously
<?php $checkboxes = [ [ 'tnid' => 45, 'Name' => 'Financial Tips', 'Email' => [], 'Href' => 'http://amt-ars-d.sevenverbs.com/api/v1/emailtemplategroups/5', ], [ 'tnid' => 42, 'Name' => 'Products', 'Email' => [], 'Href' => 'http://amt-ars-d.sevenverbs.com/api/v1/emailtemplategroups/2', ], [ 'tnid' => 44, 'Name' => 'Health Tips', 'Email' => [], 'Href' => 'http://amt-ars-d.sevenverbs.com/api/v1/emailtemplategroups/4', ], [ 'tnid' => 43, 'Name' => 'Personal Events', 'Email' => [], 'Href' => 'http://amt-ars-d.sevenverbs.com/api/v1/emailtemplategroups/3', ], [ 'tnid' => 41, 'Name' => 'Calendar', 'Email' => [], 'Href' => 'http://amt-ars-d.sevenverbs.com/api/v1/emailtemplategroups/1', ], ]; $selected = [ [ 'emarketid' => 77, 'agentid' => 81, 'customerid' => 16901, 'Seltemgr' => 'Calendar', 'seltemname' => '', ], [ 'emarketid' => 78, 'agentid' => 81, 'customerid' => 16901, 'Seltemgr' => 'Financial Tips', 'seltemname' => '', ], [ 'emarketid' => 79, 'agentid' => 81, 'customerid' => 16901, 'Seltemgr' => 'Merry Christmas', 'seltemname' => '', ], [ 'emarketid' => 80, 'agentid' => 81, 'customerid' => 16901, 'Seltemgr' => 'Drip financial tip 3', 'seltemname' => '', ], ]; var_export( array_map( fn($row) => $row + ['found' => array_any($selected, fn($selRow) => $row['Name'] == $selRow['Seltemgr'])], $checkboxes ) );
Output for 8.4.1 - 8.4.12
array ( 0 => array ( 'tnid' => 45, 'Name' => 'Financial Tips', 'Email' => array ( ), 'Href' => 'http://amt-ars-d.sevenverbs.com/api/v1/emailtemplategroups/5', 'found' => true, ), 1 => array ( 'tnid' => 42, 'Name' => 'Products', 'Email' => array ( ), 'Href' => 'http://amt-ars-d.sevenverbs.com/api/v1/emailtemplategroups/2', 'found' => false, ), 2 => array ( 'tnid' => 44, 'Name' => 'Health Tips', 'Email' => array ( ), 'Href' => 'http://amt-ars-d.sevenverbs.com/api/v1/emailtemplategroups/4', 'found' => false, ), 3 => array ( 'tnid' => 43, 'Name' => 'Personal Events', 'Email' => array ( ), 'Href' => 'http://amt-ars-d.sevenverbs.com/api/v1/emailtemplategroups/3', 'found' => false, ), 4 => array ( 'tnid' => 41, 'Name' => 'Calendar', 'Email' => array ( ), 'Href' => 'http://amt-ars-d.sevenverbs.com/api/v1/emailtemplategroups/1', 'found' => true, ), )
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.25
Fatal error: Uncaught Error: Call to undefined function array_any() in /in/SpqvBe:70 Stack trace: #0 [internal function]: {closure}(Array) #1 /in/SpqvBe(68): array_map(Object(Closure), Array) #2 {main} thrown in /in/SpqvBe on line 70
Process exited with code 255.
Output for 8.1.32
Fatal error: Uncaught Error: Call to undefined function array_any() in /in/SpqvBe:70 Stack trace: #0 [internal function]: {closure}(Array) #1 /in/SpqvBe(71): array_map(Object(Closure), Array) #2 {main} thrown in /in/SpqvBe on line 70
Process exited with code 255.

preferences:
55.24 ms | 409 KiB | 5 Q