how to use if condition in array variables? |
(04-24-2019, 10:58 PM)kvanaraj Wrote: How to use if condition in array The key point that @Wouter60 makes (but does not explain) is that you assign a value of 1 to $certid, e.g. $certid=1. But what you really wanted to do was test for equality, e.g. $certid==1. What you should have written was PHP Code: 'amt' => if($certid==1,8500 else 300 , Wouter60 writes it more concisely by using a ternary statement instead of an "if/else" statement PHP Code: 'amt' => $certid==1 ? 8500 : 300 , |
Messages In This Thread |
how to use if condition in array variables? - by kvanaraj - 04-24-2019, 10:58 PM
RE: how to use if condition in array variables? - by Wouter60 - 04-25-2019, 02:44 AM
RE: how to use if condition in array variables? - by dave friend - 04-25-2019, 09:30 AM
RE: how to use if condition in array variables? - by Wouter60 - 04-26-2019, 07:09 AM
RE: how to use if condition in array variables? - by dave friend - 04-26-2019, 07:27 AM
|