Why this is not working?
<?php
if (count($payment_method) > 0
&& !(count($payment_method) == 1
&& implode('',$payment_method) == 'PayPal'));
?>
Error is here
Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\signup\templates\default\html\subscription.php on line 239
CodePudding user response:
Change your condition to include a test on array type
<?php
if (is_array($payment_method)
&& count($payment_method) > 0
&& !(count($payment_method) == 1 && current($payment_method) == 'PayPal')
);
?>
CodePudding user response:
It means that your $payment_method
variable has to be an array or an object that looks something like:
class MyClass implements Countable {
public count(): int {}
}
You can simply learn what value it has by using the var_dump($payment_method)
function and keep on.