Answer the question
In order to leave comments, you need to log in
How to fix error with array?
The code
$mozg = preg_split("-[\W]-u", "1 2 3 4");
$go = $ilya = [];
for ($ali = 0; $ali <= count($mozg); $ali++) {
for ($bobi = 0; $bobi < $ali; $bobi++) {
$coomo = array(implode(' ', array_slice($mozg, $bobi, count($mozg) - $ali + 1)));
if (!isset($ilya[$coomo])) {
$ilya[$coomo] = array_push($go, $coomo);
}
}
}
print_r($go);
if (!isset($ilya[$coomo])) {
$ilya[$coomo] = array_push($go, $coomo);
}
Answer the question
In order to leave comments, you need to log in
Because you are using an array as a key:
$coomo = [1,2,3];
$ilya = [];
$ilya[$coomo] = 1; // this raised error
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question