i have this problem.. im doing some kind of late static binding. im really a new to this and don't know how to solve this problem. please help me to solve it...
What i want to do is instead of using static:: $arr[0].",".static:: $arr[1] i want to iterate though the array.. i tried using a foreach loop but it doesn't work.. i don't understand why.. i will really appreciate if someone demonstrate a code to do this in a better way.
this is my code.

class MainModel { 

public static function create($custArray){  
global $connection;

$query="INSERT INTO ".static:: $tblname."(";
$query.=static:: $arr[0].",".static:: $arr[1];
$query.=") VALUES ('".$custArray['name']."','".$custArray['details']."')";

        return true;
        return false;   

class ChildModel extends MainModel{ 

    protected static $tblname = 'test';
    protected static $arr=array('name','details');


//here im calling the method.. just for testing..

    echo("its working! ");
    echo("its not working! ".mysql_error());

i had to use a space in between ":: $" so it will display correctly.

what the heck is this static:: stuff? never heard of it. i would help but i dont know what ur meaning

Design patterns of the classes, methods, variables are always dependent upon the rules of concepts like abstract, static. If we do follow the rule of the abstract class and if we do follow the rule of the static keywords, all design patterns should work fine.

To my knowledge, static variables are not inherited. They are only available to that class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.