I am trying to define dynamically variables. I am using a function for this, but I don\'t know how to define the new var as global (because it never created before the function)
Try this:
function doSomething() { global $x; $x = 5; }
If you prefer to save a couple of bytes, you can use the $_GLOBALS array for this:
$_GLOBALS
$_GLOBALS['x'] = 5;