-1
$arr1 = ["C","C++","Physics","Matlab","Python","PHP","SQL","FORTRAN","React js","C+","Flutter","JAVA 123","Jupyter NotebOOOk"];
$arr2 = ["C","C++","Physics","Matlab","Python","PHP","SQL","FORTRAN","React js","C+","Flutter","JAVA 123","Jupyter Noteboook"];

These are two array i want to get the array_diff with case_senstive string

Like in Arr1 the last element is Juypter NotebOOK and in Arr2 the last element is Jupter Noteboook the string

Anyone can help me with this

  • 1
    Lower-case everything in the arrays (or *upper* case, whatever works for you), *then* diff them… – deceze Jan 21 '22 at 08:11
  • 1
    array_diff() compares string representations anyway, so it should be case sensitive out of the box; or do you mean case insensitive? – oriberu Jan 21 '22 at 08:12

1 Answers1

0

At first you have to lower case everything.

array_walk($yourArray, function(&$value)
{
  $value = strtolower($value);
});

Then you could use array_diff.

Mike Keller
  • 65
  • 1
  • 7