How To Filter The Same Data In PHP

By . Category: PHP Tags:

Filtering the same data on PHP in the beginning I used the application logic itself to be able to eliminate the same data in PHP applications. To be able to make the data displayed is only one of several of the same data then I (irnanto.com) make the source code yourself using our algorithms previously been my analysis to be able to filter out the same data that can appear only one course.

After a few hours experimenting with my algorithm (irnanto.com) made, the source code generated is less than the maximum. The brain and body was tired after many hours doing this experiment. The next day I was surfing looking for the right PHP script to be able to resolve the problems that I face are unique Bring up the data using PHP.

Ok just us apply this syntax. Below are examples of source code to filter the same data using PHP syntax, source code can be friends understand easily, just use the functions provided by PHP. I (irnanto.com) will give an example to delete an array element of equal value.

syntax: array_unique (array $ array) An example of a simple program to filter the same data in PHP.

<?php
    $kota = array(“nabire”,  “sorong”,  “manokwari”,  “merauke”, “nabire”, “jayapura”);
    $kota2 = array_unique($kota);
    print_r($kota2);
?>

Then the output results like this: Array ( [0] => nabire [1] => sorong [2] => manokwari [3] => merauke [5] => jayapura )

Ok so first of my tutorial How To Filter The Same Data In PHP, wait a continuation info and tutorials further.

Ads