Exemple #1
0
*/
error_reporting(E_ALL ^ E_WARNING);
function displayClass($o)
{
    //  var_dump($o);
    echo "\nType is >" . get_class($o) . "<\n";
    $a = (array) $o;
    //  var_dump($a);
    if (count($a) == 0) {
        echo "    Instance has no properties\n";
    } else {
        foreach ($a as $name => $value) {
            echo "    Property >{$name}< with value {$value}\n";
        }
    }
}
echo "====== explicit conversions of certain values to type object ======\n";
displayClass((object) NULL);
displayClass((object) 10);
displayClass((object) array(11, 21, 31));
echo "\n====== Use of certain values as the left-hand operand of -> ======\n";
$p = FALSE;
$p->x = 33;
displayClass($p);
$p = NULL;
$p->x = 44;
displayClass($p);
$p = "";
$p->x = 55;
displayClass($p);
    public function display_profile($id, $full = true)
    {
        if ($full) {
            return '<h1>User Info</h1>
					<img class="small_avatar" src=' . $this->avatar . ' width="32" height="32"></img>
					<span class="user_name">' . $this->nickname . '</span>
					<span class="user_steamid">' . GetAuthID($this->steamid) . '</span>
					<dl>
						<dt>Mainclass:</dt><dd><img style="float: left;" class="class_icon" src="theme/images/class/' . player_class($this->mainclass) . '.png" height="14"><span style="float: left; margin-left: 3px;">' . displayClass($this->mainclass) . '</span></dd>
						<dt>Skilllevel:</dt><dd>' . $this->division . '</dd>
						<dt>Banpoints:</dt><dd>' . $this->banpoints . '</dd>
						<dt>Rating:</dt><dd>' . $this->rating . '</dd>
					</dl>';
        } else {
            return '<div class="profile_panel">
						<h1>User Info</h1>
						<span class="user_name">' . $this->nickname . '</span><br />
						<span class="user_steamid">' . GetAuthID($this->steamid) . '</span>
						<dl>
							<dt>Mainclass:</dt><dd><img style="float: left;" class="class_icon" src="theme/images/class/' . player_class($this->mainclass) . '.png" height="14"><span style="float: left; margin-left: 3px;">' . displayClass($this->mainclass) . '</span></dd>
							<dt>Skilllevel:</dt><dd>' . $this->division . '</dd>
							<dt>Rating:</dt><dd>' . $this->rating . '</dd>
						</dl>
					</div>';
        }
    }