什么';下面的PHP脚本的执行流程是什么?

什么';下面的PHP脚本的执行流程是什么?,php,Php,我有一个test.php: <?php include "MyString.php"; print ","; print strlen("Hello world!"); 这是不是意味着使用名称空间?执行test.php包括MyString.php并执行MyString.php MyString.php在自己的命名空间中打印strlen的结果(即调用MyFramework\String\strlen(),而不是全局命名空间中的标准phpstrlen()函数),该函数输出24(12*

我有一个test.php:

<?php

include "MyString.php";

print ",";
print strlen("Hello world!");  

这是不是意味着使用名称空间?

执行
test.php
包括
MyString.php
并执行
MyString.php

MyString.php
在自己的命名空间中打印strlen的结果(即调用
MyFramework\String\strlen()
,而不是全局命名空间中的标准php
strlen()
函数),该函数输出
24
(12*2)。。。。然后
MyString.php
终止,控制权返回到
test.php

test.php
接下来打印一个逗号,然后打印
strlen()
的结果,该结果使用标准php strlen,因为它不再在
MyFramework\String
命名空间中执行,所以输出为12


MyString.php
中名为
strlen()
的函数中
\
之前的
意味着使用标准(根命名空间级别)strlen()函数

我不知道为什么有人给这个问题一个负号,但这是一个关于php命名空间的问题,php命名空间是PHP5.3之后的一个新特性。如果你觉得这个问题很无聊或者没有用,请告诉我你的观点我没有投反对票,但是,仅供参考,PHP5.3已经过时了。
<?php

namespace MyFramework\String;

function strlen($str)
{
    return \strlen($str)*2; // return double the string length
}
print strlen("Hello world!");
namespace MyFramework\String;

function strlen($str)
{
    return \strlen($str)*2; // return double the string length
}