<?php function config( $key = null ){ // $config = parse_ini_file('../out_of_root/app.ini'); $config = []; $config['base_url'] = '/mypath/'; if ( is_null($key) ){ return $config; } else if ( array_key_exists($key, $config) ) { return $config[$key]; } else { return "key doesn't exist"; } } class myclass{ public function myfunc(){ echo config('base_url'); } } $obj = new myclass; $obj->myfunc();
You have javascript disabled. You will not be able to edit any code.