<?php
$someGlobalVar = "test";
class myClassTest
{
public $var1;
public $var2;
public $var3;
function __construct($arg1,$arg2=null){
if ($arg2 === null){
global $someGlobalVar;
$arg2 = $someGlobalVar;
}
echo $arg2;
$this->var1 = $arg1;
$this->var2 = $arg2;
$this->var3 = array();
}
}
$class = new myClassTest('something'); //outputs test