執行 ❯
獲取您
自己的 PHP
伺服器
×
更改方向
更改主題,深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <body> <?php function myTest() { $x = 5; // local scope echo "<p>Variable x inside function is: $x</p>"; } myTest(); // using x outside the function will generate an error echo "<p>Variable x outside function is: $x</p>"; ?> </body> </html>
函式內的變數 x 的值是: 5
函式外的變數 x 的值是