3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ [ 'hash' => '0xa35b44d7e2ff09f2c936d04ad53f472b3cae46b449ddd307b3bb0a9aa67aa7a0', 'from' => '0x87fdc1fd91cb8a7db0021f1d749027b7048874cb', 'to' => '0xe460c28e4ce2e4ae0b934a3eeb8fd88134d26956' ], [ 'hash' =>'0x3f85168d763793e350b4273c531b055d37121b170a48675ba5decd80b62442d5', 'from' => '0xe460c28e4ce2e4ae0b934a3eeb8fd88134d26956', 'to' => '0x1faae436c85a15f257f7ff7f02af1e608815bbd7' ], [ 'hash' => '0x621de75f0a2a880e17efc2c40a310223c38fa19b71b2dae375a9bc4d4d794a1a', 'from' => '0xe460c28e4ce2e4ae0b934a3eeb8fd88134d26956', 'to' => '0x1faae436c85a15f257f7ff7f02af1e608815bbd7' ], [ 'hash' => '0x4a32e142b627a1541d0dc5605ef9c52b7f586f02ab502d13d0503321622ba435', 'from' => '0xe460c28e4ce2e4ae0b934a3eeb8fd88134d26956', 'to' => '0x1faae436c85a15f257f7ff7f02af1e608815bbd7' ], [ 'hash' => '0x0b40f67a334aae4cd54977e5e4cd5f54a2157f75441d5143d1eed4ba70f19b8f', 'from' => '0xe460c28e4ce2e4ae0b934a3eeb8fd88134d26956', 'to' => '0x1faae436c85a15f257f7ff7f02af1e608815bbd7' ] ]; $pa = strtolower('0xE460c28E4cE2e4aE0B934a3eeb8FD88134d26956'); $result = ['from' => [], 'to' => []]; foreach ($data as $set) { if ($pa == $set['from']) { $result['Sent'][] = $set['hash']; } elseif ($pa == $set['to']) { $result['Received'][] = $set['hash']; } } echo "For $pa\n"; echo "Sent Transactions:\n\t" , implode("\n\t", $result['Sent']) , "\n"; echo "Received Transactions:\n\t" , implode("\n\t", $result['Received']);
Output for 5.6.38 - 5.6.40, 7.0.33, 7.1.0 - 7.1.33, 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.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
For 0xe460c28e4ce2e4ae0b934a3eeb8fd88134d26956 Sent Transactions: 0x3f85168d763793e350b4273c531b055d37121b170a48675ba5decd80b62442d5 0x621de75f0a2a880e17efc2c40a310223c38fa19b71b2dae375a9bc4d4d794a1a 0x4a32e142b627a1541d0dc5605ef9c52b7f586f02ab502d13d0503321622ba435 0x0b40f67a334aae4cd54977e5e4cd5f54a2157f75441d5143d1eed4ba70f19b8f Received Transactions: 0xa35b44d7e2ff09f2c936d04ad53f472b3cae46b449ddd307b3bb0a9aa67aa7a0

preferences:
136.29 ms | 409 KiB | 5 Q