3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function generatePassword($username, $password ) { /* 1. RESULT = LOWER_CASE ( username ) + PASSWORD 2. RESULT = LOWER_CASE ( SHA1_HEX(RESULT) ) 3. RESULT = SESSIONID + RESULT 4. RESULT = UPPER_CASE ( SHA1_HEX(RESULT) ) */ $this->_sessionid = 'GEW4JHV7H7JOR5IV868R'; if( $this->_sessionid ) { //1. $result = strtolower( $username ) . $password; //2. $result = strtolower( sha1( $result ) ); //3. $result = $this->_sessionid . $result; //4. $result = strtoupper( sha1( $result ) ); } else { $result = false; } return $result; } print_r(generatePassword('599750531', '4321')); ?>
based on Rns08
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/bftQr:10 Stack trace: #0 /in/bftQr(28): generatePassword('599750531', '4321') #1 {main} thrown in /in/bftQr on line 10
Process exited with code 255.
Output for 5.3.17 - 5.6.28
Fatal error: Using $this when not in object context in /in/bftQr on line 10
Process exited with code 255.