[Question] Matching an array in PHP menu

Shout-Out

User Tag List

Results 1 to 2 of 2
  1. #1
    ev1's Avatar Banned
    Reputation
    98
    Join Date
    Nov 2008
    Posts
    428
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Question] Matching an array in PHP

    Basically i want to take an array of numbers let's say:

    Code:
    <?
    $array1=array("1","2","3","4");
    ?>
    Now say i reprint that same array, but the 3 is missing.

    Code:
    <?
    $array2=array("1","2","4");
    ?>
    How would i print what's missing from $array1 out of $array2?

    Sorry if this is confusing, i'll be happy to go into details if needed.

    ---------- Post added at 02:27 AM ---------- Previous post was at 02:06 AM ----------

    Got a fix, i wasn't thinking right today - asked on another forum and go this as a reply:

    Code:
    <?php
    $arr1 = array(1, 2, 3, 4);
    $arr2 = array(1, 2, 4);
    
    $difference = array_diff($arr1, $arr2); // Returns all values from arr1 that are not present in arr2
    
    print_r($difference); // Array(0 => 3)
    ?>

    [Question] Matching an array in PHP
  2. #2
    invadertag's Avatar Member
    Reputation
    9
    Join Date
    Jan 2007
    Posts
    81
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

Similar Threads

  1. [Question] PHP Mailer
    By ZhoX in forum Programming
    Replies: 4
    Last Post: 06-20-2009, 07:16 AM
  2. Replies: 9
    Last Post: 04-27-2009, 10:55 AM
  3. Interest in php tuts or coding questions?
    By Gravecorp in forum Programming
    Replies: 6
    Last Post: 02-25-2009, 07:10 AM
  4. [question] Account.php command level
    By xaverz in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 05-24-2008, 05:27 AM
All times are GMT -5. The time now is 02:37 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search