Welcome Guest, Not a member yet? Register   Sign In
sub functions in class

I have a problem with functions in classes

here is an example
class Admin extends Controller {
var $admin;
var $id;

    function Admin()
function someffunction(){
function subfunction(){
return $result;



become as error, I try to find in here and in google, but can't really find if possible to get sub functions with data.

I know have nice thing &get;_instance, but my question if it's possible to get without this.

Sorry, I'm not quite sure what you're trying to acheive here, and why you'd want a funtion in a function?
Also, you should really move the db calls to a model Smile

Just an Idea is, In my CMS website have a plugins facility, and I want to live these separately from root code. In general everything it's fine, but some times I need some extra function. I can solve this If I use &get;_instance. and all data loads fine, but I not really like this method.

I'm not sure if you understand what I mean, but the main question is, if it's possible to get function from function with $this method.

I know this need very few times.

You might be able to do that if your somefunction returned an object of a class, but you wouldn't be able to write your functions like that.

Functions that are not part of a class are global. PHP does not allow a class definition to expand across files. I don't think you can do what you want.

Theme © iAndrew 2016 - Forum software by © MyBB