Skip to content
Advertisement

Tag: arrays

PHP Multidimensional array number formatting returns A

I am having issue with number formatting of array elements. It always returns an “A” letter, no matter element value. I am calling for that value with adress $tab[‘VII’][‘B’][‘podatek’][‘PTUG’] An this is part of an Array: I am using tcpdf with this file as well, if that is making a trouble. What i need is to in proper fields call

Combine object values in a single array by matching object fields in PHP

I’ve been digging around and trying to solve this issue the cleanest way possible, but haven’t quite found the right approach. I have an array of objects like so: and I need to combine the objects that have duplicate measurement fields and combine the counts like this: can it be done with something like array_map or something equally clean and

Recursive function and add to an array

I need recursive function to add element into an array. This is my code: Basically, if I echo $new_x and $new_y, I get what I’m expecting. Problem is my $result array, it gives me only first item (2 -2) but second is missing (1 -1). I guess problem is with adding item into array but cannot find the problem. Answer

PHP: Adapt number ID to words

What do I need to do to convert the number only if all the number matches? At the moment, it’s converting to each number. (I’ve tried to do a lot and I didn’t succeed) I would like to know if have any way of adapting to only show the word if the number “is complete”, otherwise show the word “Doesn’t

Shuffle() returns same results

I’m having a problem with using a basic shuffle() function in Laravel. It returns the same result, which seems to be changing once every 10 or 20 minutes. Here’s the basic code I’m testing: And here’s the log: Answer You probably initialize your random seed with a constant value somewhere else.

Advertisement