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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:51:02+00:00 2026-06-05T11:51:02+00:00

I am trying to check two sentences in greek equal with this function: private

  • 0

I am trying to check two sentences in greek equal with this function:

   private function process_line_three($target_line_three,$case_line_three){
      $target_line_three=trim($target_line_three);
       $case_line_three=trim($case_line_three);
      echo "<br/><br/>";
       var_dump($case_line_three);
        echo "<br/><br/>";
        echo mb_detect_encoding($target_line_three);
        echo "<br/><br/>";
         echo mb_detect_encoding($case_line_three);
       //$this->print_chars_not_equal($target_line_three,$case_line_three);

   return strcasecmp($target_line_three, $case_line_three)==0;
   }

When I pass them the following two strings I get this:

Line 3: case Συνδέσου με χιλιάδες ανθρώπους Παρακολούθησε & δράσε ζωντανά 24/7==Συνδέσου με χιλιάδες ανθρώπους Παρακολούθησε & δράσε ζωντανά 24/7

But equality fails here.. i return false on that result, even though both sentences are similar.. why is that so?

UPDATE :

var_dump($case_line_three); string(117) “Συνδέσου με χιλιάδες
ανθρώπους Παρακολούθησε & δράσε ζωντανά 24/7”

meanwhile, i am trying to find an encoding issue

UPDATE 2:
the output is:

string(117) "Συνδέσου με χιλιάδες ανθρώπους Παρακολούθησε & δράσε ζωντανά 24/7" 

UTF-8

UTF-8

both characters are utf

UPDATE 3
output when I write to a file:

Συνδέσου με χιλιάδες ανθρώπους Παρακολούθησε &amp; δράσε ζωντανά 24/7

Συνδέσου με χιλιάδες ανθρώπους Παρακολούθησε & δράσε ζωντανά 24/7
  • 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-05T11:51:03+00:00Added an answer on June 5, 2026 at 11:51 am

    You could use strncmp to compare the two strings character for character, stopping when they are not equal. Then you could determine which character(s) is different. levenshtein might tell you how many characters are different.

    $a = 'Συνδέσου με χιλιάδες ανθρώπους Παρακολούθησε & δράσε ζωντανά 24/7';
    $b = 'Συνδέσου με χιλιάδες ανθρώπους Παρακολούθησε & δράσε ζωντανά 24/7';
    
    $i=1; $l=strlen($a); $equals=true;
    while ($i<=$l && $equals) {
        if (strncmp($a, $b, $i) != 0) {
            $equals = false;
        } else {
            $i++;
        }
    }
    if ($equals) {
        echo 'Strings are equal';
    } else {
        echo 'Character '.$i.' is not equal';
    }
    

    Strings are equal for me, so it is probably an encoding issue. You could use mb-detect-encoding to check the encoding of the offending characters http://www.php.net/manual/en/function.mb-detect-encoding.php

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

Sidebar

Related Questions

I'm trying to pass two values to a function, so that i can check
I'm trying to check if two objects (e.g. a rectangle and a triangle) on
I'm trying to check if the count from two tables are the same I
I'm trying to check if a file exists. If I use this: NSData *data
I'm trying to set up two check box's in a DataGrid so that only
From MBUnit I am trying to check if the values of two objects are
I'm trying to check wether two MovieClips are of the same kind or not.
Trying to get two different counts in one query. To do this I am
I'm trying to check if two values exist side by side each other. on
I am trying to check if a certain hash element exists. I have two

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.