Home > Backend Development > PHP Tutorial > 关于PHP内核的问题

关于PHP内核的问题

WBOY
Release: 2016-06-23 13:25:46
Original
1017 people have browsed it

$name = 'TIPI Team';
$func = function() use($name)
 {
    echo "Hello, $name";
 }
 
$func(); 
?>
按照PHP内核讲解手册中介绍的那样,应该会输出Hello TIPI Team
但我执行后,出现了如下的错误:


回复讨论(解决方案)

不知道是为什么?难道是版本的问题?PS:我用的是最新的版本,PHP5.6了。

少了分号而已。

<?php $name = 'TIPI Team';$func = function() use($name) {    echo "Hello, $name"; }; // 这里有个分号的。 $func(); ?>
Copy after login

谢谢!的确是这样,看来还是我太大意了!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template