Jump to content

Array_diff


verdrm

Recommended Posts

I have two strings:

 

$string = shell_exec('reg.bat '.$arg);  //returns word\0word\0word
$stringA = "$string";
$stringB = "word,other,word2,other2";
$array1 = explode('\0', $stringA);
$array2 = explode(',', $stringB);
$result = array_diff($array1, $array2);

 

I can use array_diff to find the differences, but the last word in $array1 shows up as not in both strings even though it is because of the \0 delimiter. How can I include the last word as well?

 

Link to comment
https://forums.phpfreaks.com/topic/209791-array_diff/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.