Oh. In that case I'll have to reconsider my casting strategy. Thanks!Weirdan wrote:Through testing I found the intval to be about 10 times slower compared to (int). Maybe it is because intval understands hexadecimal strings.Mordred wrote: 2. I find intval() to be the more readable variant of the two, but IIRC someone here said that internally casting and calling the function do the same.
As for Hungarian, I too come from (actually still am, in my day job) C++. I find it easier to track the intent behind my variables. This doesn't mean that the occasional $sResult doesn't end being "false" on error and so on, I'm not forcing strinct typing into my coding, just "hinting" at it.
For OOP I go even further, I use $this->m_nIntMember and $pObject->m_sStringMember, etc. This makes it easy (for me) to track the following two possible mistakes:
Code: Select all
//in a class method
$m_nIntMember = 0; //huh, m_ prefix without a -> in front of it? ALERT ALERT ALERTCode: Select all
$sResult = '';
//...
$this->sResult .= '<hr>'; //-> without a m_ prefix? ALERT ALERTI also do $g_pGlobalObject and $s_sStaticString when the need arises.
And yep, I do CamelCasing, but not of the Java semiCamelCased variety, all functions start with a capital. But well, it's my religious upbringing I guess, the church of C++