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
  • 5
  • 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
  • 14,898
  • 22
  • 85
  • 134
1

You need to add the correct logical operator:

if ($line[3] <= 12 || $line[10] < 1)
Kostas Mitsarakis
  • 4,742
  • 3
  • 24
  • 36