Search
 
SCRIPT & CODE EXAMPLE
 

PHP

array unique php

<?php
$input = array("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique($input);
print_r($result);
?>
Comment

array unique php

<?php
    // Syntax: array_unique(array $array, int $flags = SORT_STRING): array
    // Desc: Removes duplicate values from an array
    $arr = Array("red", "red", "green", "blue", "blue", "white");
    echo "<pre>";
    print_r($arr);
    echo "</pre> <br><br>";
    
    $arrUnique = array_unique($arr);

    echo "<pre>";
    print_r($arrUnique);
    echo "</pre> <br><br>";

    /* -------- output -----------
    Array
    (
        [0] => red
        [1] => red
        [2] => green
        [3] => blue
        [4] => blue
        [5] => white
    )
    
    Array
    (
        [0] => red
        [2] => green
        [3] => blue
        [5] => white
    )
    */
?>
Comment

PREVIOUS NEXT
Code Example
Php :: elvis operator php 
Php :: facetwp listing template archive 
Php :: woocommerce coupon notifie a spefic email 
Php :: how to calculate position of student in class in laravel 
Php :: laravel count the types of users 
Php :: Wordpress even odd post count 
Php :: htaccess rewriterule 
Php :: slim disable display error details 
Php :: Laravel group collection and sort by the biggest value 
Php :: php get sql update from session 
Php :: Include Or Require Multiple Files On 1 Line 
Php :: check if product has crosssell woocommerce 
Php :: retrievemultipleimage from database in laravel 
Php :: php Write a program to reverse an array or string 
Php :: php csv to multirow array $_FILES 
Php :: enhanced ecommerce data layer for woocommerce 
Php :: PHP catch eval output 
Php :: $n = readline(); for($i = 0; $i < $n ; $i++) { $name = readline(); $names[$name] = (isset($names[$name]) ? $names[$name] + 1 : 1); } 
Php :: t_lnumber php 
Php :: The app function returns the service container instancel 
Php :: keep multiple values in select box after reload in php 
Php :: how to put external file in laravel listener class 
Php :: wordpress redirect attachment page to file 
Php :: PHP quoted_printable_decode — Convert a quoted-printable string to an 8 bit string 
Php :: how to use db more than 1 codeigiter 3 
Php :: Online Food Ordering System Project SQL 
Php :: undefine variable $variable in php 
Php :: PHP str_rot13 — Perform the rot13 transform on a string 
Php :: jobs laravel 
Php :: !array_push($stack, "apple", "raspberry"); 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =