This question is linked to this one :
Is it possible to hint the type of the items inside a returned array ?
e.g. :
/** * MyFunction does a lot of things * * @param TClass1 $var1 * @param TClass2 $var2 * @return array[TClass3] //<- I'm trying to express this */ function MyFunction( $var1, $var2 ){ ...
I am using NetBeans as an IDE, which takes (like many other PHP IDEs) advantage of the doc blocs above functions to determine the type of returned values.
If I could explain what type is expected inside an array, I could hope for the IDE to be able to offer correct completion for the following case :
$myTab = MyFunction( $foo, $bar ); foreach( $myTab as $itm ){ $itm->myFi| //offer the completion for a TClass3 object }
One of the most common ways to find duplicates is by using the brute force method, which compares each element of the array to every other element. This solution has the time complexity of O(n^2) and only exists for academic purposes.
The easiest way to find duplicate elements is if the phone number is just a 6-digit number and has type Int, you could sort the array of phone numbers and than filter that to find duplicates. And so on. @Mazyod - from the answer: "you could SORT the array of phone numbers and than FILTER that to find duplicates."
Use
@return TClass3[]
or
@return TClass3[]|TClass3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With