InArray condition on server connect

It seems like there should be an InArray conditional in the server connect formatter.

I added my own which seems to be working fine:

function formatter_inArray($val, $theArray) {
    return in_array (  $val , $theArray )  !== FALSE;

Is this already included and I’m missing it?


Good one Ken!

Most array formatters currently are more collection oriented as the commonly used data structures of records are presented as arrays of objects.

But we could definitely add a few more array specific ones.


Thanks George…there are obviously a bunch of array functions that would be easy to implement and very helpful in data manipulation.

Do note that we have already a lot of array functions that are currently under the collections category as collections share the same array underlying structure.

So there you will find the most common array formatters as well.

Yep, got that. I’m thinking of things like this:

function formatter_arrayDiff($baseArray, $compareArray) {
    return array_diff($baseArray, $compareArray);

Are the values of the first array, found anywhere in the second array.

My use case today is importing two csv files with tens of thousands of records. I just need to know which items are not found in the second array and this is a quick way to make that happen instead of building a repeat, and comparing.

1 Like

Yes I have suggested that before:

1 Like