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

  • SEARCH
  • Home
  • 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 6652153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:06:03+00:00 2026-05-26T01:06:03+00:00

How can compare each a from content json_encode that inserted in database with a

  • 0

How can compare each a from content json_encode that inserted in database with a string as shorthand code without use loop? (this values was checkbox that inserted in database with json_encode)

Example

$json_encode = ["how", "are", "hello", "what"];

echo ($json_encode == 'hello') ? 'It is true' :'';
  • 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-26T01:06:04+00:00Added an answer on May 26, 2026 at 1:06 am

    The code is a little bit of a ’round a bout’ way of doing things but this should do the trick:

    $json_encode = '["how", "are", "hello", "what"]';    
    echo ( in_array('hello', json_decode($json_encode)) ? 'It is true' :'' );
    

    Your initial $json_encode isnt setup correctly as a proper JSON string, and required decoding to use the array checking functionality later on.

    A better approach maybe:

    $json_string = json_encode(array("how", "are", "hello", "what"));
    echo ( in_array('hello', json_decode($json_string )) ? 'It is true' :'' );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to read a String sentence from a Textfield and compare each letter
I have an IEnumerable, listOfOnes, and an IEnumerable, listOfTwos. Assuming that I can compare
I am trying to compare two tables to find rows in each table that
In some library code, I have a List that can contain 50,000 items or
I have been getting an error message that I can't resolve. It originates from
I am trying to compare each element from two array $min and $max $test
I need to compare a 1-dimensional array, in that I need to compare each
I have a String to Brush converter that I use in WPF to color
is there a way l can compare two columns | fields in django like
I would like to know if there is anyway I can compare two columns

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.