<?php
//設定此頁面使用 UTF8 編碼
header('Content-Type: text/html; charset=utf-8');

$x=5;
testVar();

function testVar() {
  //宣告 $x 為全域變數
  global $x;

  if ( isset($x)  ) {
    echo '$x 已經定義, 變數值為 ' . $x;
  }
  else {
    echo '$x 未定義';
  }
}
?>
