3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class SensitiveInfo { private $cipher = "AES-256-CBC"; private $secret_key = "fj239fDSDf932kk21c"; private $secret_iv = "3fn4d2k3j3nxdlpo32"; private $options = 0; private $iv = null; public function __construct() { $this->secret_key = hash('sha256', $this->secret_key); $this->iv = substr(hash('sha256', $this->secret_iv), 0, 16); }//end __construct() public function hide(string $str): string { return base64_encode(openssl_encrypt( $str, $this->cipher, $this->secret_key, $this->options, $this->iv )); }//end maskData() public function unhide(string $str) { $str = base64_decode($str); return openssl_decrypt( $str, $this->cipher, $this->secret_key, $this->options, $this->iv ); }//end maskData() }//end class $si = new SensitiveInfo(); $encrypted = $si->hide("Hello World"); var_dump($encrypted); var_dump($si->unhide($encrypted));
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function openssl_encrypt() in /in/Xi5WF:28 Stack trace: #0 /in/Xi5WF(48): SensitiveInfo->hide('Hello World') #1 {main} thrown in /in/Xi5WF on line 28
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
57.93 ms | 401 KiB | 8 Q