Adding PHP Line Spaces In Codeigniter

Saturday, July 5, 2014

I am trying to write file but just need to work out best way to make some gaps/spaces between some code “[‘default’][‘hostname’]” space . ‘=’ . space “‘localhost’”can not work it out.


At the moment when reload page it produces $db['default']['hostname']='localhost'; but need gap/space $db['default']['hostname'] = 'localhost';



<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {

public function index(){
$output = '<?php' . "\n";

$output .= "\n";

$output .= '// DB' . "\n";

$output .= '$db' . "['default']['hostname']" space . '=' . space "'localhost'". ";" . "\n";

$file = fopen(APPPATH . 'config/database-test.php', 'w');

fwrite($file, $output);

fclose($file);

$this->load->view('welcome_message');
}
}






http://ift.tt/1pRtujg