Problem Statement:
In Order to optimize my code , I was thinking how to write the last two lines of code in one statement.
$v1 = functionName;
$strR = "get".$v1;
echo $obj->$strR();
as i wana get $obj->getfunctionName();
Solution :
echo $obj->{"get" . $v1}();
Reason :
1. Bench marking reports suggest the solution is optimized.
2. Code looks more professional.
In Order to optimize my code , I was thinking how to write the last two lines of code in one statement.
$v1 = functionName;
$strR = "get".$v1;
echo $obj->$strR();
as i wana get $obj->getfunctionName();
Solution :
echo $obj->{"get" . $v1}();
Reason :
1. Bench marking reports suggest the solution is optimized.
2. Code looks more professional.
No comments:
Post a Comment