为了账号安全,请及时绑定邮箱和手机立即绑定

遇到的问题

我用的是在线编辑器,然后运行的结果不一样,老师能解决一下吗http://img1.sycdn.imooc.com//5a1e7825000100bf03860220.jpg

正在回答

2 回答

<?php
//第二种全局变量$GLOBALS,将使用过的全局变量全部显示出来
print_r($GLOBALS);
echo '<hr/>';
$name='king';
$age=12;
$email='123@qq.com';
function test5(){
    echo '用户名:'.$GLOBALS['name'].'<br/>';
    echo '年龄:'.$GLOBALS['age'].'<br/>';
    echo '邮箱:'.$GLOBALS['email'].'<br/>';
}
test5();
?>


0 回复 有任何疑惑可以回复我~
#1

longlang 提问者

这个运行之后还是这样的,那个用户名、年龄、邮箱后面都没有跟的,这是在线编辑器的问题吗?
2017-12-01 回复 有任何疑惑可以回复我~
#2

幻世遇见 回复 longlang 提问者

不要使用在线编辑器 本地测试即可
2017-12-04 回复 有任何疑惑可以回复我~
#3

longlang 提问者 回复 幻世遇见

行,谢谢了
2017-12-05 回复 有任何疑惑可以回复我~
<?php
$heredoc = <<< HEREDOC_ID
some $contents
HEREDOC_ID;

function foo() {
   $a = [0, 1, 2];
   return SomeClass::$shared;
}

// Sample comment

class SomeClass extends One implements Another {
   private $my;
   public static $shared;
   const CONSTANT = 0987654321;
   /**
    * Description by <a href="mailto:">user@host.dom</a>
    * Semantic highlighting:
    * Generated spectrum to pick colors for local variables and parameters:
    *  Color#1 SC1.1 SC1.2 SC1.3 SC1.4 Color#2 SC2.1 SC2.2 SC2.3 SC2.4 Color#3
    *  Color#3 SC3.1 SC3.2 SC3.3 SC3.4 Color#4 SC4.1 SC4.2 SC4.3 SC4.4 Color#5
    * @param $abc
    * @param $def
    * @property $magic
    * @return SomeType
    */
   function doSmth($abc, $def) {
      foo();
      $def .=  self::magic;
      $def .=  self::CONSTANT;
      $v = Helper::convert($abc . "\n {$def}" . $$def);
      $q = new Query( $this->invent(abs(0x80)) );
      return array($v => $q->result);
   }
}

interface Another {
}

include (dirname(__FILE__) . "inc.php");
`rm -r`;

goto Label;

Label:
№


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

遇到的问题

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信