Several conditions within the same if php

1

I need to create an if with several conditions there are many examples in the forum but I do not give any to serve me. I need the if check two conditions the first one checking if the $user_id equals the auth()->user()->id) if it does not match the second option that would verify if $ privacy is null in addition to point greater than 100 I hope I have explained it well.

This is what I'm trying to do but is this syntax correct? "It's just a bad example for you to understand me better"

@if( ( $user_id == auth()->user->id ) or ( $private = null and point >=100 )  )
    
asked by Lendy Rodriguez Silva 05.11.2018 в 03:30
source

1 answer

1

I commented that it should look like this

@if( $user_id == auth()->user->id or $private == null and point >=100 )

the details

  • remove the parentésis of more
  • besides that in: $private = null you are assigning that the variable $private is worth null , in any case if you want to know if the variable $private is equal to null you must use double symbol of equal ==
  • You should always bear in mind the following:

    = means assignment: $a = 5; here I say variable a equals 5 == means comparison: $a == $b; here I compare if the variable $a has the same value as $b

        
    answered by 06.11.2018 / 16:54
    source