Why does this PHP program not work?

Posted by oncode on Stack Overflow See other posts from Stack Overflow or by oncode
Published on 2010-05-12T12:42:52Z Indexed on 2010/05/12 12:54 UTC
Read the original article Hit count: 138

Filed under:
|

I'm new to PHP and was learning about PHP functions from w3schools. It said PHP allows a function call to be made when the function name is in a variable:

This program worked

<?php
$v = "var_dump";
$v('foo');
?>

But this program did not work:

<?php
$v = "echo";
$v('foo');
?>

But if I do echo('foo'); it works. What am I doing wrong?

© Stack Overflow or respective owner

Related posts about php

Related posts about functions