I am trying to define a php function inside a codeigniter view and use $data variable in it. For example this is my controller
class Something extends CI_Controller {
public function index()
{
$data = array();
$data["world"] = "hello world"
$this->load->view('something', $data);
}
}
This is my view something
function doSomething(){
echo $world;
}
doSomething();
The expected result is hello world.