Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Why is doing this bad?

$
0
0

So, Throughout my script it seemed logically correct to call a function via a variable value.

 

Example I have

function computer()
{
return  'pcs are good';
}

function laptop()
{
return  'laptops are ok';
}

$value = 'computer';

echo $value();

$value = 'laptop';

echo $value();

However, After just googling this, I saw alot of criticism towards this technique, Whats the problem with this?

 

Thanks in advance.


Viewing all articles
Browse latest Browse all 13200

Trending Articles