to get the file
to get the file
to get the file
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Scalar Type Conversions<br />
• Explicit type conversions in three different ways<br />
• Using cast: (type_name) exp<br />
(Ex) $<strong>to</strong>tal = 4.333; (int) $<strong>to</strong>tal // 4<br />
• Using function: intval, doubleval, strval<br />
(Ex) $<strong>to</strong>tal = 4.333; intval($<strong>to</strong>tal) // 4<br />
• Using settype function: settype (variable, type_name)<br />
(Ex) settype($<strong>to</strong>tal, "integer") // 4<br />
• The type of a variable can be determined with <strong>get</strong>type<br />
or type testing functions<br />
• <strong>get</strong>type($<strong>to</strong>tal) - returns <strong>the</strong> type of <strong>the</strong> current value.<br />
It may return "unknown"<br />
• is_integer($<strong>to</strong>tal), is_float(), is_bool(), is_string()<br />
– a predicate function<br />
25