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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:01:11+00:00 2026-06-16T23:01:11+00:00

I am getting two different count values for same string $val1 = $data->sheets[0][‘cells’][5][1];//thise value

  • 0

I am getting two different count values for same string

 $val1 = $data->sheets[0]['cells'][5][1];//thise value is from excel sheet 
 $val2 = $obj->number; // this is the value from database

 var_dump(trim($val1)) , var_dump(trim($val2))

string(19) "US5922335A" ,  string(10) "US5922335A" 

first values is getting from excel sheet(xls)and The second value is am getting from Mysql table after performing Select query
, i am unable to perform comparision like as both are having different length .

if($val1==$va2)
{
    echo "Found it ";   
}

How can i make it to have a same length so that i can compare it.

  • 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-06-16T23:01:13+00:00Added an answer on June 16, 2026 at 11:01 pm

    Not a direct answer to your question but let’s first find out what’s really behind that string(19) "US5922335A". Please try

    foreach(array($val1,$val2) as $v ) {
        for($i=0; $i<strlen($v); $i++) {
            printf('%02x ', ord($v[$i]));
        }
        echo "<br />\n";
    }
    
    if($val1==$val2) {
        echo "Found it ";   
    }
    

    and add the output which should be something like

    55 53 35 39 32 32 33 33 35 41 <br />
    55 53 35 39 32 32 33 33 35 41 <br />
    

    to your question.


    edit: Your data seems to be little endian UCS-2/UTF-16 encoded.

    i am getting as

    string(22) "EP2153814A1" string(10) "US5922335A"
    45 00 50 00 32 00 31 00 35 00 33 00 38 00 31 00 34 00 41 00 31 00
    55 53 35 39 32 32 33 33 35 41

    Since your data source for that string value is an Excel sheet the easiest solution is probably to use mb_convert_encoding() to change the encoding.

    $val1 = $data->sheets[0]['cells'][5][1];
    $val1 = mb_convert_encoding($val1, 'ISO-8859-1', 'UTF-16LE');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a union query that's getting the count from two different populations. How
I've never had this issue before, so I'm somewhat lost. I'm getting two different
I'm getting book info from two different Google Books bookshelves via the API and
I need help getting two pieces of data, and comparing them. What I am
I'm trying to make two Kinects getting along under the same application. I've tried
I am facing an issue in getting the correct frame for two different strings.
I'm having some trouble getting two different SSH keys/GitHub accounts to play well together.
I am using predicates to refine search options and am getting two different results
I am getting two different results while I would expect the result to be
I've got two different arrays that I'm using. With one, I'm getting the exact

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.