// Other variables
$MAX_FILENAME_LENGTH = 260;
$file_name = $_FILES[$upload_name]['name'];
//echo "testing-".$file_name."<br>";
//$file_name = strtolower($file_name);
$file_extension = end(explode('.', $file_name)); //ERROR ON THIS LINE
$uploadErrors = array(
0=>'There is no error, the file uploaded with success',
1=>'The uploaded file exceeds the upload max filesize allowed.',
2=>'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
3=>'The uploaded file was only partially uploaded',
4=>'No file was uploaded',
6=>'Missing a temporary folder'
);
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?2天后仍然卡住了.
请帮我把这个伪代码翻译成真正的PHP代码:
foreach ($arr as $k => $v)
if ( THIS IS NOT THE LAST ELEMENT IN THE ARRAY)
doSomething();
Run Code Online (Sandbox Code Playgroud)
编辑:数组可能有数字或字符串键
在另一个问题中指出,在括号中包装PHP函数调用的结果可以某种方式将结果转换为完全成熟的表达式,以便以下工作:
<?php
error_reporting(E_ALL | E_STRICT);
function get_array() {
return array();
}
function foo() {
// return reset(get_array());
// ^ error: "Only variables should be passed by reference"
return reset((get_array()));
// ^ OK
}
foo();
Run Code Online (Sandbox Code Playgroud)
我试图在文档中找到任何内容,以明确无误地解释这里发生的事情.与C++不同,我不太了解PHP语法及其语句/表达式的处理方法,以便自己派生它.
有关此行为的文档中是否隐藏了任何内容?如果没有,其他人可以解释它而不诉诸假设吗?
我首先发现这个EBNF声称代表PHP语法,并试图自己解码我的脚本,但最终放弃了.
然后,使用phc生成.dot两个foo()变体的文件,我使用以下命令为两个脚本生成 AST图像:
$ yum install phc graphviz
$ phc --dump-ast-dot test1.php > test1.dot
$ dot -Tpng test1.dot > test1.png
$ phc --dump-ast-dot test2.php > test2.dot
$ dot -Tpng …Run Code Online (Sandbox Code Playgroud)