Link to home
Start Free TrialLog in
Avatar of pc-buddy
pc-buddy

asked on

Php Array Diff

Hi,

I have 2 arrays

$dates
Array
(
    [0] => 2016-11-01
    [1] => 2016-11-08
    [2] => 2016-11-15
    [3] => 2016-11-22
    [4] => 2016-11-29
)

$holidays
Array
(
    [0] => 2016-11-07
    [1] => 2016-11-08
    [2] => 2016-11-09
    [3] => 2016-11-10
    [4] => 2016-11-11
)

$totals =  array_diff($dates, $termtimedates) . '<br><br>';
			
			echo $totals . '<br><br>';

Open in new window


All I get back is word "Array"

Any ideas thanks
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pc-buddy
pc-buddy

ASKER

Yeah just figured that out haha, thanks
This happens any time PHP does type-coercion from Array to String (not just in echo).  It's a terrible design flaw, but it's too late to fix it now that it's been baked into the language.  A more appropriate approach would be to trigger a warning!