1

Desciption:

I have an array 2d:

$array = InvApplication::model()->findall(array('order'=>'app_name'));

The array contents the next element: "app5", How to avoid it?

Actual Output:

app_name|field1|field2|fieldN|..|..
 appn    |
 appn1   |
 appn2   |
 app5    |

Already Tested

I have been testing with unset, in_array and strpos functions. In addition to:

php - finding keys in an array that match a pattern

Delete element from multidimensional-array based on value

My actual piece of code:

This is an actual way, but is not working as I want.

$deleteapp = "app5";
unset($list[$deleteapp]); Test with unset or array_diff
        foreach($list as $k=>$v)
        {
            if(in_array($v,array('app5'))) unset($list[$k]);}

I expect this:

app_name|field1|field2|fieldN|..|..
 appn    |
 appn1   |
 appn2   |

Thank you.

1 Answer 1

0

seems you want exclude a app_name from the select result in this case you could use a condition

$array = InvApplication::model()->findall(
  array("condition"=> "app_name !=  'app5'","order"=>"app_name")
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.