[FX.php List] Editing Checkboxes

Erik Andreas Cayré erik at cayre.dk
Wed Oct 25 16:53:58 MDT 2006


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1856 bytes
Desc: not available
Url : http://www.iviking.org/pipermail/fx.php_list/attachments/20061026/dd11038e/smime.bin


More information about the FX.php_List mailing list