3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); error_reporting(E_ALL); $b = []; // original result var_dump(!trim(((string)($b['b'] ?? '')))); // applied change to replace above leading to different result var_dump(trim(((string)($b['b'] ?? ''))) !== ''); // replacement with same result would be this, // but it's not clear if the original check has // been ment to be that kind of check and was // obsured away. var_dump(trim(((string)($b['b'] ?? ''))) === '');
Output for 8.2.31 - 8.2.36, 8.3.0 - 8.3.37, 8.4.1 - 8.4.28, 8.5.0 - 8.5.13, 8.6.0
bool(true) bool(false) bool(true)

preferences:
19.17 ms | 1164 KiB | 6 Q