This is the piece of code, i think i am confused because everything is all in place but it is not working.
Dreamweaver says:It say there is a syntax error in line 50, which is the last line in beneath code?>
<?php
array_walk(array('big', 'small', 'original'), function(&$v, $k) {
$dir = ROOT_PATH.'user/upload/'.$row['UserName'].'/avatar/' . $v;
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
}
?>
As i am newbie to PHP so it is difficult for me to find it out. If there is any software to detect these kind of problems then please let me know.
Thanks in advance.
You're missing the closing bracket and colon of the array_walk
function:
$array = array('big', 'small', 'original');
array_walk($array, function(&$v, $k) {
$dir = ROOT_PATH.'user/upload/'.$row['UserName'].'/avatar/' . $v;
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
}
);
If your IDE or text editor doesn't provide you with hints about unclosed brackets and so on, you can turn on error reporting on a per-script basis by adding the following to the top of your php scripts:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);