Browsing Category How To

PHP get Array Values from another Array Keys

Let’s say you have these two arrays :

And you want to grab two items of this array without using foreach and conditions, what would you do? The solution is simple, we’re going to use array_intersect_key in conjunction with array_flip to get an array of what we picked, here how it works:

In that code we’re telling php that we want the Orange, and the Apple, the full php code will be:  

 

PHP how to echo an Array

There are multiple ways to print/echo and array in php:

 

PHP: How to get the Max and Mix value in an Array

It is very simple to get the Max and Min value in an array, with a built in function .

 

PHP: How to Redirect

Redirecting a web page is as easy as adding two lines of codes

That’s It!