Is there any way that I can get content of a PHP file in to variable?
I want to do this
$msg = $this->load->view(\'some_view\');
$string = $this->load->view('myfile', '', TRUE);
https://codeigniter.com/user_guide/general/views.html#returning-views-as-data
It is possible:
$msg = $this->load->view('some_view', '', true);
There is a third optional parameter lets you change the behavior of the function so that it returns data as a string rather than sending it to your browser. This can be useful if you want to process the data in some way. If you set the parameter to true (boolean) it will return data. The default behavior is false, which sends it to your browser. Remember to assign it to a variable if you want the data returned:
$msg = $this->load->view('some_view', '', true);
Source : http://codeigniter.com/user_guide/general/views.html