Re: New construct discussion Summary

From: Date: Tue, 13 Jul 2004 01:29:42 +0000
Subject: Re: New construct discussion Summary
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-11140@lists.php.net to get a copy of this message
* Thus wrote Rasmus Lerdorf: > > So, perhaps introduce the value() function which doesn't do any type > casting and enhance the intval(), strval() and floatval() functions to act > like value() but cast appropriately unless the default arg is returned. > To retain backward compatibility the intval() function's default arg would > have to be after the optional base arg. If this route is taken, what about using the name nullval() to make it fit into the naming schema? The prefix null implying no casting will occur. Going on the assumption: unset($var); echo intval($var); // 0 echo strval($var); // "" echo floatval($var); //0.00 echo nullval($var); //null $var = 1; echo intval($var); // 1 echo strval($var); // "1" echo floatval($var); //1.00 echo nullval($var); // 1 or $var = "1"; echo nullval($var); // "1" Although, i think that the intval()'s base option complicates things a little. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid!

« previous php.internals (#11140) next »