M
M
Morfeey2017-09-27 16:41:35
PHP
Morfeey, 2017-09-27 16:41:35

How to solve the syntax problem?

59cba9ef0d22c814613393.jpeg
Parse error: syntax error, unexpected '.', expecting ',' or ';'
And so in the lines that have a line gluing in the fields. Anyone faced?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
AUser0, 2019-06-16
@Huf

The $parts array is formed from the value of $this->request->get['path'] by splitting this value into parts at the underscore character. If $this->request->get['path'] is empty, then $parts will be empty and an error will occur.
Since $category_id is allowed to be null later in the script, add $parts = array(0); before the 45th line, the error will disappear. And it's better to do:

//-- GET ALL PRODUCTS FILTER BY CATEGORY
if(isset($this->request->get['path'])) {
$parts = explode('_', (string)$this->request->get['path']);
$category_id = (int)array_pop($parts);
} else {
$category_id = 0;
}

A
Alexander Aksentiev, 2017-09-27
@Morfeey

First, does it refer to itself? O_O How is it theoretically even supposed to work?
Second, you can't do that.
In the constructor, sculpt if you need to do so.

M
Maksim Fedorov, 2017-09-28
@Maksclub

Tell me, is it generally correct to set so many properties?
Do I understand correctly that in the context of a large property system, classes should be grouped into DTOs?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question