then i think i need to reply back to show my respect to weed 🙂
Yoda Language starts
basically, i don't like, dislike OOP becoz i cannot agree with the concept of object oriented and the coded resulted from using OOP approach tend to be larger than procedural code where 2 of them actually perform the same function.
one of the logic is, less things(code) easier to manage than large(code) things. this is the main reason why i ditch the oop.
i on with OOP some time ago and the conclusion i got is, OOP will just make the code hard to manage and i am the type that don't want many files appeared to have the app functions or runs.
i view OOP as just a method of grouping variables and functions together inside a class. thats all
they said reusable classes, but u can still reuse your coded procedural functions as u reuse the classes.
from what i experience, OOP just ease your way to obtain and setting variable values. thats all,
with functional procedure, u might need to global and will get mess if u need to global a lot of variables.
so, to show you how much i enjoy the procedural way,
function memory() {
static $data;
switch(func_get_arg(0)) {
case 'a':
$args = func_get_args();
memory_parse($args[1]);
@eval("\$data{$args[1]} = \$args[2];");
break;
case 'g':
$args = func_get_args();
memory_parse($args[1]);
@eval("\$r = \$data$args[1];");
return isset($r) ? $r : false;
break;
case 'dbg':
return $data;
break;
}
}
function a($oMap, $oData) {
return memory('a', $oMap, $oData);
}
function g($oMap) {
return memory('g', $oMap);
}
function memory_parse(&$oMap) {
if(substr_count($oMap, '.') != 0) {
$oMap = explode('.', $oMap);
$oMap = "['".implode("']['", $oMap)."']";
if(substr($oMap, -4) == "['']") {
$oMap = substr($oMap, 0, -4).'[]';
}
} else {
$oMap = "['".$oMap."']";
}
}
i don't think i need to show how to use it, easy to understand code what... 🙂
a is for add
g is for get.