1

I have a line in php like this:

if ($line[3]<=12)

And now I need to add new condition while keeping the old one. Something like this, but is not working:

if ($line[3]<=12|$line[10]<1)

Could you please help? Thank you so much!

amplatfus
  • 17
  • 6
  • 1
    Possible duplicate of [Reference - What does this symbol mean in PHP?](https://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php) – GrumpyCrouton Jul 14 '17 at 14:11

2 Answers2

2

Very basic question dude. Have a look on logical operators in PHP.

If you want ONE of the conditions to be valid:

if ($line[3]<=12 || $line[10]<1)

If both conditions must be valid:

if ($line[3]<=12 && $line[10]<1)
Blackbam
  • 17,496
  • 26
  • 97
  • 150
1

You need to add the correct logical operator:

if ($line[3] <= 12 || $line[10] < 1)
Kostas Mitsarakis
  • 4,772
  • 3
  • 23
  • 37