Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7177783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:47:08+00:00 2026-05-28T16:47:08+00:00

I have a php comma seperated string $string = (x,y,z) I have a column

  • 0

I have a php comma seperated string
$string = (x,y,z)

I have a column in mysql that has items (y,z)

how do i compare the two and echo which items in $string are not in the column?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:47:09+00:00Added an answer on May 28, 2026 at 4:47 pm

    I think you want to compute differente in two comma separated strings.

    Just convert your strings in to array using explode and use array_diff

    array_diff – Computes the difference of arrays

    Example :

    <?php
    
    $array1=explode(",",$string);
    $array2=explode(",",$yourstring_of_db_column);
    $array1 = array("x", "y", "z");
    $array2 = array( "y","z");
    $result = array_diff($array1, $array2);
    
    print_r($result);
    ?>
    

    Be aware Values are compared using ===, so 1 and “1” are considered different.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP MySQL application which has a modular design. There are about
I have a php comma separated string $string = (x,y,z) I have a column
I have PHP scrip that goes like this: if ($cost_frm < $cost){ echo <script
I have a program that returns a comma-separated string of numbers after doing some
I have a PHP keyword search script that searches a MySQL database and then
Possible Duplicate: Split string in SQL Searching a column with comma seperated values In
I have PHP configured so that magic quotes are on and register globals are
We have PHP 5.2.6 deployed to c:\php and in that folder there is the
I have php script that creates a temporary watermark image for users that are
I have php scripts that do things like register, login, upload. I would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.