[FX.php List] Editing Checkboxes

Joel Shapiro jsfmp at earthlink.net
Wed Oct 25 17:17:46 MDT 2006


Thanks Erik!

(I realized just after I sent my message that it was "checked= 
\"checked\"", though it was the structure I was really curious about.)

so
    x ? a : b

is the same as

    if (x) {a} else {b}


You're right that it's harder to read (at least at first!), but I  
like it.

Thanks,
-Joel


On Oct 25, 2006, at 3:53 PM, Erik Andreas Cayré wrote:

>
> Den 26/10/2006 kl. 0.47 skrev Joel Shapiro:
>
>> I'm curious about the question mark and the colon in the structure  
>> of this line:
>>
>> $checked = ( eregi($value,$dJP['answer06'][0])) ? "checked= 
>> \"checked\"" : "";
>>
>> Is it the same as saying:
>>
>> if ( eregi($value,$dJP['answer06'][0]) ) {
>> 	$checked = "checked";
>> } else {
>> 	$checked = "";
>> }
>
> No, it's the same as:
>
> if ( eregi($value,$dJP['answer06'][0]) ) {
> 	$checked = "checked=\"checked\"";
> } else {
> 	$checked = "";
> }
>
>> Is this specific to regular expressions?
>
> No, it's standard PHP syntax.
> It's shorter but a little harder to read. Some people are religious  
> about which to (not) use. I use both ad hoc...
>
> ---
> Erik Andreas Cayré
> Spangsbjerg Møllevej 169
> DK-6705 Esbjerg Ø
>
> Home Tel: +45 75150512
> Mobile: +45 40161183
>
> »If you can't explain it simply, you don't understand it well enough.«
> -- Albert Einstein
>
> »If you don't have time to do it right, when will you have time to  
> do it over?«
> -- John Wooden, basketball coach
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list