Questions tagged as 'array'

1
answer

Is there a difference when joining two arrays with array_merge or with "+"? [duplicate]

I used to merge two arrays into PHP using the array_merge function: $arr3 = array_merge($arr1, $arr2); However, more recently I have seen arrays unions with + (sum sign): $arr3 = $arr1 + $arr2; Is there any differen...
asked by 27.06.2016 / 11:22
2
answers

Function print with error

I made a program that calculates the Fibonacci numbers in X and Y using Z as a helper. When I pass the Fibonacci function vector to the imprime function, it does not print. I made a test by putting cout inside the for of...
asked by 02.05.2016 / 21:23
2
answers

How to loop with while using array

Hello, I would like to know if it is possible to loop using while so I need the values of the $newsmedias1 array to be placed in while in order to make the appearance of the items with the given IDS in the Array as lo...
asked by 22.10.2015 / 15:41
1
answer

How to convert a JavaScript array to array in PHP?

The system gives me a JavaScript matrix to work on the page. I can get this array with PHP, but I do not know how to convert from JavaScript to PHP and work using PHP. This is an example of the JavaScript array: <script type="text/...
asked by 02.03.2015 / 04:04
1
answer

What is the maximum amount an array can support in PHP?

In PHP I usually work a lot with frameworks. Generally, they even bring query results to a database in array . In some cases, when the number of data in a table or a relationship reaches a very large level, if we do not use features lik...
asked by 24.02.2016 / 13:05
1
answer

More elegant ways to reverse integers, arrays, and strings in Python

Save! I've been looking for elegant ways to reverse strings, arrays, and integers in Python. What do you think of my codes below and what do they suggest to improve them? They work ... Thank you! frase = 'eu gosto de python'[::-1] num...
asked by 28.10.2015 / 00:33
5
answers

Problem with in_array ()

I have a problem with the in_array function. I made a var_dump() in the array I want to search for: array(2) { ["28c8edde3d61a0411511d3b1866f0636"]=> array(8) { ["id"]=> string(32) "c4ca4238a0b923820dcc509a6f75849...
asked by 11.11.2015 / 10:54
1
answer

How do I call Arrays.sort (array, new methodOrd ()) in Java?

Knowing that I have a class with an array of objects and another class that implements the interface Comparator . I would like any example just to learn and be able to sort an array of objects by their name in my class that implements...
asked by 17.09.2014 / 16:26
1
answer

How to create a function equal to Array.Copy from C # in C ++

I would like to create a function similar to the Array.Copy of C # in C ++. This function has the prototype like this: public static void Copy( Array sourceArray, int sourceIndex, Array destinationArray, int destinati...
asked by 28.01.2016 / 17:47
1
answer

What happens if a binary search does not find the element?

What happens if a binary search does not find the element? Does it enter loop ? What is the best way to end execution?     
asked by 23.11.2017 / 02:52