3v4l.org

run code in 300+ PHP versions simultaneously
<?php class pumps extends CI_Controller{ function __construct(){ parent::__construct(); $this->load->model('pump'); } function index(){ // $this->load->view('common/header'); $this->load->view('pumps/index3'); } function singlepump($pump_id = null){ if( !$this->pump->ownsReservation($pump_id) || is_null($pump_id) || $pump_id > 8 || $pump_id < 0) { redirect(''); } log_message('info','Request: Clearing reservations and resetting motors'); error_log('Request: Clearing reservations and resetting motors'); var $reservations = $this->pump->getReservations(); foreach ( $reservations as $resvd_id => $status ) { if ( $status === 'OPEN' ) continue; log_message('info','Request: Motor #' . $resvd_id . ' set to speed of 0'); error_log('Request: Motor #' . $resvd_id . ' set to speed of 0'); $command_string = '/webroot/fountain/server_side.py -m ' . $resvd_id . ' -s 0'; exec($command_string); } $this->pump->clearReservations(); $this->pump->createReservation($pump_id); $this->load->view('pumps/singlepump', array('pump_id' => $pump_id)); } function init(){ //Using the controller allows the connection to be made //by the server and not by the client. //This will also allow us to check for reservations //And create session data $ip_address = $this->input->get('ip_address'); $motor = $this->uri->segment('3'); $speed = $this->uri->segment('4'); $this->pump->createReservation($motor); log_message('info','Request: Motor #' . $motor . ' set to speed of ' . $speed); error_log('Request: Motor #' . $motor . ' set to speed of ' . $speed); $command_string = '/webroot/fountain/server_side.py -m ' . $motor . ' -s ' . $speed; exec($command_string); /* $url = 'http://10.0.0.126/minit/' . $motor . '/' . $speed; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 0, CURLOPT_URL => $url )); curl_exec($curl); curl_close($curl); * */ echo $this->pump->createReservation($motor); } function status(){ $state = $this->pump->getReservations(); # echo '<pre>'; echo json_encode($state,JSON_FORCE_OBJECT); # echo '</pre>'; } function telnet(){ exec('/webroot/fountain/server_side.py -m 0 -s 1000'); } }
Output for 5.4.0 - 5.4.35
Parse error: syntax error, unexpected 'var' (T_VAR) in /in/VfBGs on line 22
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_VAR in /in/VfBGs on line 22
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, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_VAR in /in/VfBGs on line 22
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/VfBGs on line 22
Process exited with code 255.

preferences:
212.92 ms | 1395 KiB | 125 Q