-3

I have an html form contains some inputs. In my PHP function I have some conditions and depended if some inputs are set on or not I call the right function. Here is the example :

if($a)
   //Call the function 1
elseif($a == 0)
   //Call the function2

 if($b)
   //Call the function 1
elseif($b == 0)
   //Call the function2

So i have two HTML inputs when one of them is setted i call the right function. The problem is when one of them is empty it's still calls the function and in the condition i set == 0 and not !$aper example. So someone can help me please Thanks.

Sparky
  • 98,165
  • 25
  • 199
  • 285
Karimx
  • 73
  • 1
  • 11

1 Answers1

2

Check this out How do the PHP equality (== double equals) and identity (=== triple equals) comparison operators differ?

You may want to compare using === for the typesafe comparison between the input and the number 0

Community
  • 1
  • 1
BIU
  • 2,340
  • 3
  • 17
  • 23