3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Note extends CI_Controller { /*************************** Note CRUD ***************************/ // list records function notes_records() { $data = array(); if($query = $this->note_model->get_records()) { $data['records'] = $query; } $this->load->view('note', $data); } // note create function create() { if($_POST) { $data = array( 'title' => $this->input->post('title'), 'note' => $this->input->post('note') ); $this->note_model->add_record($data); redirect('site/members_area'); } else { $data['main_content'] = 'create_note'; $this->load->view('includes/template', $data); } } // edit form function edit() { if($query = $this->note_model->get_edit()) { $data['records'] = $query; } $data['main_content'] = 'note_edit'; $this->load->view('includes/template', $data); } // update data function update() { $data = array( 'title' => $this->input->post('title'), 'note' => $this->input->post('note') ); $this->note_model->update_record($data); redirect('site/members_area'); } // delete note function delete() { $this->note_model->delete_record(); redirect('site/members_area'); } /*************************** CATEGORY ***************************/ // create category function create_category() { $this->load->helper('form'); $this->load->library(array('form_validation')); // set validation rules $this->form_validation->set_rules('category_name', 'Name', 'required|max_length[200]|xss_clean'); if ($this->form_validation->run() == FALSE) { //if not valid $data['main_content'] = 'create_category'; $this->load->view('includes/template', $data); } else { //if valid $data = array( 'cat_title' => $this->input->post('category_name') ); $this->note_model->create_category($data); redirect('site/members_area'); } } // list notes by category`s function category_records() { if($query = $this->note_model->get_category()) { $data['records'] = $query; } if($query_note = $this->note_model->get_records()) { $data['notes_by_category'] = $query_note; } $data['main_content'] = 'category'; $this->load->view('includes/template', $data); } }
Output for 5.0.0 - 7.1.0
Fatal error: Class 'CI_Controller' not found in /in/QuuWE on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Class note: Cannot inherit from undefined class ci_controller in /in/QuuWE on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Class note: Cannot inherit from undefined class ci_controller in /in/QuuWE on line 3