Как осуществляется передача? В заголовках?- да можно и заголовки передавать
В вашем примере WHERE a=1 будет использовать индекс, WHERE a=1 and b=2 тоже, а WHERE c='text' - не будет.Rsa97, explain утверждает обратное.
if ($date < date('Ymd', $wall['date'])) {
if ($date < date('Y-m-d', $wall['date'])) {
$folders = [
(object) ['id' => 1, 'parent' => 0, 'name' => 'foo'],
(object) ['id' => 2, 'parent' => 1, 'name' => 'bar'],
(object) ['id' => 3, 'parent' => 0, 'name' => 'foo2'],
(object) ['id' => 4, 'parent' => 3, 'name' => 'bar2']
];
var_dump(folderpath($folders));
function folderpath($folders) {
$out = [];
foreach ($folders as $id => $data) {
$path = [];
if ($data->parent == $parent) {
$path[] = $data->name;
$sub = folderpathrec($folders, $data->id);
if (strlen($sub) > 0) {
$path[] = $sub;
}
}
if (count($path) > 0) {
$out[] = implode(DIRECTORY_SEPARATOR, $path);
}
}
return $out;
}
function folderpathrec($folders, $parent = 0) {
$path = [];
foreach ($folders as $id => $data) {
if ($data->parent == $parent) {
$path[] = $data->name;
$sub = folderpathrec($folders, $data->id);
if (strlen($sub) > 0) {
$path[] = $sub;
}
}
}
return implode(DIRECTORY_SEPARATOR, $path);
}
$folders = [
(object) ['id' => 1, 'parent' => 0, 'name' => 'foo'],
(object) ['id' => 2, 'parent' => 1, 'name' => 'bar']
];
var_dump(folderpath($folders));
function folderpath(&$folders, $parent = 0) {
$path = [];
foreach ($folders as $id => $data) {
if ($data->parent == $parent) {
$path[] = $data->name;
$sub = folderpath($folders, $data->id);
if (strlen($sub) > 0) {
$path[] = $sub;
}
}
}
return implode(DIRECTORY_SEPARATOR, $path);
}
var expression = 'return 2+2+2;'
var result = eval('(function() {' + expression + '}())');
alert(result);
var expression = 'return 2+2+2;';
var result = new Function(expression)();
alert(result);
а так?
https://jsfiddle.net/c1epamps/