I would like to note, this is just to see if it can be done. I am not looking to do anything with it.
Just as the title states, I would like to see if a PHP class can be made into a procedural function.

Going by this link, going over the basics of OOP. I wanted to see if this could be done with regular functions:

Here is the class from the site
PHP Code:
// class definition
class Bear {
    
// define properties
    
public $name;
    public 
$weight;
    public 
$age;
    public 
$sex;
    public 
$colour;

    
// constructor
    
public function __construct() {
        
$this->age 0;
        
$this->weight 100;
        
$this->colour "brown";
    } 

    
// define methods
    
public function eat() {
        echo 
$this->name." is eating... ";
    }

    public function 
run() {
        echo 
$this->name." is running... ";
    }

    public function 
kill() {
        echo 
$this->name." is killing prey... ";
    }

    public function 
sleep() {
        echo 
$this->name." is sleeping... ";
    }


// extended class definition
class PolarBear extends Bear {

    
// constructor
    
public function __construct() {
        
parent::__construct();
        
$this->colour "white";
        
$this->weight 600;
    }

    
// define methods
    
public function swim() {
        echo 
$this->name." is swimming... ";
    }


// my first bear
    
$daddy = new Bear;
// give him a name
    
$daddy->name "Daddy Bear";
// how old is he
    
$daddy->age 8;
// what sex is he
    
$daddy->sex "male";
// what colour is his coat
    
$daddy->colour "black";
// how much does he weigh
    
$daddy->weight 300;

// give daddy a wife
    
$mommy = new Bear;
    
$mommy->name "Mommy Bear";
    
$mommy->age 7;
    
$mommy->sex "female";
    
$mommy->colour "black";
    
$mommy->weight 310;

// and a baby to complete the family
    
$baby = new Bear;
    
$baby->name "Baby Bear";

// a nice evening in the Bear family
// daddy kills prey and brings it home
    
$daddy->kill();

// mommy eats it
    
$mommy->eat();
// and so does baby
    
$baby->eat();

// mommy sleeps
    
$mommy->sleep();
// and so does daddy
    
$daddy->sleep();

// baby eats some more
    
$baby->eat(); 

    echo 
$baby->name." is ".$baby->colour." and weighs ".$baby->weight." units at birth"

// create instance of Bear()
    
$tom = new Bear;
    
$tom->name "Tommy Bear";

// create instance of PolarBear()
    
$bob = new PolarBear;
    
$bob->name "Bobby Bear";

// $bob can use all the methods of Bear() and PolarBear()
    
$bob->run();
    
$bob->kill();
    
$bob->swim();

// $tom can use all the methods of Bear() but not PolarBear()
    
$tom->run();
    
$tom->kill();
    
// $tom->swim(); Tom fails at swimming because it is a method of Polar Bear, not Bear 
Instead of a bear, let's make a cat
PHP Code:
function construct$var$str ) {
    
$var = !isset($var) ? $str $var;
    return 
$var;
}

function 
cat$array ) {
    
// constructor
    
$array['weight'] = construct$array['weight'], );
    
$array['age']      = construct$array['age'], );
    
$array['colour'] = construct$array['colour'], 'brown' );

    
// properties
    
return array(
        
'name' => $array['name'],
        
'weight' => $array['weight'],
        
'age' => $array['age'],
        
'sex' => $array['sex'],
        
'colour' => $array['colour']
//        ,'eats' => 'eating'
    
);
}

// Extend Cat
function tabbyCat$array ) {
    
// constructor
    
$array['weight'] = construct$array['weight'], 10 );
    
$array['colour'] = construct$array['colour'], 'orange' );
    
    return 
cat$array );
}

function 
eating($name) {
    echo 
$name." is eating... ";
}

function 
runing($name) {
    echo 
$name." is running... ";
}

function 
killing($name) {
    echo 
$name." is killing prey... ";
}

function 
sleeping($name) {
    echo 
$name." is sleeping... ";
}

function 
pooping($name) {
    echo 
$name." is pooping... ";
}

// 2 cats
    
$morris cat(array('name' => 'Morris'));
    
$heacliff cat(array('name' => 'Heacliff'));
// and a kitten
    
$kitten cat(array('name' => 'Baby Cat'));

// a nice evening in the cat family
// morris kills prey and brings it home
    
killing$morris['name'] );

// both eat the prey
    
eating$morris['name'] );
    
eating$heacliff['name'] );

// both sleep
    
sleeping$morris['name'] );
    
sleeping$heacliff['name'] );

// morris eats some more
    
eating$morris['name'] ); 

echo 
$kitten['name']." is ".$kitten['colour']." and weighs ".$kitten['weight']." units at birth..."

// ANOTHER CAT?!?!?!
    
$hobbes tabbyCat(array('name' => 'Hobbes'));
        
eating($hobbes['name']);
        
pooping($hobbes['name']);
    
        
// Morris gotta go too
        
pooping($morris['name']);

// Hobbes has a tag, let's get his infor
// AGE is inherited from the parent 
    
echo $hobbes['name'].', an '.$hobbes['colour'].' cat, weighed '.$hobbes['weight'].' units at birth at '.$hobbes['age'].' years old...'
Obviously, I can't put the action functions in cat and then have it inherited by tabbyCat, I get a function already defined error. So i am trying to pass it via the array and call it as such - $morris['eats'](); This doesn't work as the parameter $name is not called.

So my question is, short of me placing the functions in the function, how can I call up the method functions from the parent function? I was thinking of adding another array with the function name and parameter and doing an in_array with call_user_func, but I tried something similar and it caused the code to be run when cat() was called. That is the other issue, allowing the code to run when it is called, not when the parent function is called.

Either way, it is just to see if it can be done.