Ermm... It skips the index 13? No Google answer? Picture explanation: incremental index array: no associative form of json. Disruption: associative. I believe I'm using pmmp's PHP 7.2.1 downloaded at 21/1/2018 on https://ci.appveyor.com/project/pmmp/php-build-scripts. Is there any update about this recently? Mintty, can't be edited:
Please explain what exactly your issue is. You're getting the entity ID, which increments for every entity. Because you hardly posted any code however, we can't find out why apparently not all entities go through that bit of code you posted.
Its the elements of the smaller array. The index of the outer array is not affected by the entityId whatsoever. Besides, that is the on-the-go status of the array. It runs just like a script. No other code is run while that code is running. PHP: $a = ["a", "b", "c"];$a[] = "d";// $a is now [0 => "a", 1 => "b", 2 => "c", 4 => "d"]
Yes that is fine. I would like to fix that myself. PHP: self::$entityEquiping[count(self::$entityEquiping)] = [$entity->getLevel()->getId(), $entity->getId(), $task->getTaskId()];// Simplified version: $a[count($a)] = "d"; It's internal PHP bug. Don't ask anyone.
PHP: $a = ["a", "b", "c"];$a[] = "d";var_dump($a); Output: array(4) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" [3]=> string(1) "d" } PHP works fine. (at least in this case)
Of course it works fine for years and for my 0 -> 12 index until the 14th element comes up. It constantly happening, with the server restarted, not just once. It's a pmmp plugin by the way
I don't really understand what issue you are having. are you saying $arr[] = $val; $arr[count($arr)] = $val; behave differently?
It's the same. My problem is that my code doesn't behave right every single circumstance. The $arr[] = $val; should put the [1,39,11899] to the index 13, not 14. Do you understand my problem ?
PHP: <?php$arr = [];for($i = 0; $i < 13; $i++){ $arr[] = "some_val";}var_dump("Before(".count($arr)."):".json_encode($arr));$arr[] = "some_val";var_dump("After(".count($arr)."):".json_encode($arr)); Code: string(155) "Before(13):["some_val","some_val","some_val","some_val","some_val","some_val","some_val","some_val","some_val","some_val","some_val","some_val","some_val"]" string(165) "After(14):["some_val","some_val","some_val","some_val","some_val","some_val","some_val","some_val","some_val","some_val","some_val","some_val","some_val","some_val"]" Do you alter your self::entitiyEquiping somewhere else?
1. That's all my code. I know my code enough, again, that is a **continuous** script. How can the 2 var_dump next to each other and with the array in-between can be altered? 2. I don't say your code is either wrong or right. My problem is the problem with that PHP internally. I would say again, that my problem, with that PhpStorm IDE screenshot taken live and the pmmp console log couldn't be edited, is not producing the array it should be.
All I want to access is how the PHP binary is not pushing that value to the index 13. Doesn't it mean nothing, that this just works for every circumstances except this one?
Thanks anyway. I think I'm the bad person so no one accepts my bug, as it can't be reproducible and I don't have any knowledge of debugging php.
You're forgetting that array indexes start at zero. The next correct index would be the count of the existing array elements minus one. PHP: self::$entityEquiping[count(self::$entityEquiping) - 1] = [$entity->getLevel()->getId(), $entity->getId(), $task->getTaskId()];
well, in his original code he doesn't use count. And @instantlyta : My question remains: Do you alter your self::entitiyEquiping somewhere else?