I am using laravel. I have 2 arrays. For example
$array1 = [
'test1',
'',
'test2',
'test3',
'',
'test4',
'',
];
$array2 = [
null
];
dd(array_diff($array1, $array2));
result is
array:4 [▼
0 => "test1"
2 => "test2"
3 => "test3"
5 => "test4"
]
but I expected
array:7 [▼
0 => "test1"
1 => ""
2 => "test2"
3 => "test3"
4 => ""
5 => "test4"
6 => ""
]
Can you ask why in array_diff considered null is equal '', and how can I fix it without any additional cods
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2xhOYgr
via IFTTT
Aucun commentaire:
Enregistrer un commentaire