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 481003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:57:02+00:00 2026-05-13T00:57:02+00:00

First, I tried searching for different variations of the title I’ve put for this

  • 0

First, I tried searching for different variations of the title I’ve put for this question, both on Stack Overflow and Google. I couldn’t find a solution.

I am fairly new to PHP. New enough to not know the difference between using eq and == for string comparison!

I usually use == to compare strings in PHP. I am comfortable with it.

But I’ve seen code using eq to compare strings. And I vaguely remember someone making an observation like ‘Oh! I used == to compare strings. I should have used eq‘.

I just want to know whether using == is okay to do simple string comparisons? I am not talking about special cases, case-sensitive, substring or any fancy type of string comparison. Just checking whether apple is the same as apple.

Is == enough? or should I use eq.


My mistake 🙁 thanks a lot for clearing my ‘not-well-researched’ question! It must have been Perl. I got confused seeing the code embedded inside HTML and thought it was a different way of embedding PHP. Sorry.

  • 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-13T00:57:02+00:00Added an answer on May 13, 2026 at 12:57 am

    To accompany my comments: The eq operator in Perl tests for string equality, while the == tests for numerical equality only.

    Even though PHP started once as a collection of Perl scripts, I don’t think, they have copied this operator and this page seems to agree.

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

Sidebar

Related Questions

I have tried to find the answer to this question on both the Spring
I've tried searching this on Google and here but nothing like the issue I'm
First post here, I have tried searching but couldn't find what I'm looking for
I tried searching for this, but couldn't find much. It seems like something that's
I'm new here. :) I tried searching first, but couldn't find exactly what I'm
Ok, so I tried searching around first but I didn't exactly know how to
Controller First I tried this: [HttpPost] public ActionResult Edit(JournalEntry journalentry) { if (ModelState.IsValid) {
This is driving me crazy. I've tried searching for answers and nothing quite matches
I had previously asked a question MYSQL Searching multiple tables with different columns using
Quick question regarding CSS and the browser. I tried searching SO and found some

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.