3v4l.org

run code in 300+ PHP versions simultaneously
<?php class testobj{ public $id; public $username; public $email; private function setId($id){ $this->id = $id; } private function setUsername($un){ $this->username = $un; } private function setEmail($email){ $this->email = $email; } public function load($i,$u,$e){ $this->setId($i); $this->setUsername($u); $this->setEmail($e); } } $test1 = new testobj(); $test1->load('1',"richardgow","richard.gow@tracesmart.co.uk"); $test2 = new testobj(); $test2->load('2',"emailtest1","richard.gow@tracesmart.co.uk"); $test3 = new testobj(); $test3->load('3',"emailtest2","richard.gow@tracesmart.co.uk"); $test4 = new testobj(); $test4->load('4',"emailtest3","richard.gow@tracesamrt.co.uk"); $testhold = Array(); $testhold[0] = $test1; $testhold[1] = $test2; $testhold[2] = $test3; $testhold[3] = $test4; $urlarr = array( 0 => "www.test1.com", 1 => "www.test2.com", 2 => "www.test3.com", 3 => "www.test4.com" ); //fake url helper class urlmake { static public function makeUrl($input){ return "www." . $input->username . ".com"; } } //all above test code -- below implemenation $tableouter = '<table border="1" style="width:100%">'; $tableend = "</table>"; $row = "<tr>"; $td = "<td>"; $tdend = "</td>"; $rowend = "</tr>"; $htmlinsert = ""; $htmlContent = "<p>A request has been made to reset your password on the Tracesmart 'Single Sign On' system. Your username is.</p> <p>Please visit the following URL in order to reset your password:<br/>"; $plainContent = strip_tags(html_entity_decode($htmlContent)); $htmlinsert = $plainContent; $htmlinsert = $htmlinsert . $tableouter; for($i = 0; $i < count($testhold); $i++){ $htmlinsert = $htmlinsert . $row . $td . $testhold[$i]->username . $tdend . $td . urlmake::makeUrl($testhold[$i]) . $tdend . $rowend ; } $htmlinsert = $htmlinsert . $tableend; echo $htmlinsert; //actual implmentation of function to move the url gen out of the code. private function outPutUrl($token){ $url = $this->_helper->url->url( array( 'module' => 'sso', 'controller' => 'password', 'action' => 'reset', 'token' => $token, 'scheme' => 'https', ) ); return $url; } //code for calling this being $this->outPutUrl($token); ?>
Output for 5.4.0 - 5.4.34
Parse error: syntax error, unexpected 'private' (T_PRIVATE) in /in/M9OKr on line 91
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_PRIVATE in /in/M9OKr on line 91
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_PRIVATE in /in/M9OKr on line 91
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/M9OKr on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/M9OKr on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/M9OKr on line 3
Process exited with code 255.

preferences:
223.59 ms | 1399 KiB | 124 Q