Sunday, December 17, 2017

Display matching arrays values

Here in the below method, we created two arrays and assign to $users and $admins variables,now to compare these arrays we added for loop as shown below, and get count of $admins variable. In the previous article we had used arrays concept which will be useful for reference.

we had in_array() method to get the matching array values,let us know about in_array() method,it checks for existing array values,now let’s see syntax below

Here in the place of needle we need to add searched variable as $admins[i], which compares each and every value in $users and prints the matching values as below.

we can also display unique values in arrays by using array_unique() method,here in the below example we created array with duplicate values.

Thanks for reading this article

Tags: , ,
I am Saritha Reddy, a Remote codeigniter,Angularjs Developer. I have 4+ years of strong experience in designing, implementing, Programming and delivering advanced XAMPP ( Apache, MySQL and PHP) Web applications development. I am an Indian national and based Andhra Pradesh,Hyderabad. In addition to providing custom programming and design, I also have extensive experience with Open Source technologies to keep costs down and get websites running with as little fuss and wait as possible.

0 Comments

Leave a Comment