3v4l.org

run code in 300+ PHP versions simultaneously
<?php function connect($login, $password) { throw new exception ("Connect error!"); } echo "Credentials exposed\n"; try { try { connect("login", "password"); } catch (Throwable $e){ throw $e; } } catch (Throwable $e){ echo $e; // only for demonsration! do no use echo in the catch block } echo "\n\nCredentials hidden:\n"; try { try { connect("login", "password"); } catch (Throwable $e) { throw new exception($e->getMessage()); } } catch (Throwable $e) { echo $e; // only for demonsration! do no use echo in the catch block }
Output for 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.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Credentials exposed Exception: Connect error! in /in/3Ygq8:4 Stack trace: #0 /in/3Ygq8(10): connect('login', 'password') #1 {main} Credentials hidden: Exception: Connect error! in /in/3Ygq8:22 Stack trace: #0 {main}

preferences:
121.64 ms | 1663 KiB | 4 Q