Any idea on how to progress with this idea?
I certainly would like to see it in PHP 5.4 but i don't have the knowledge
nor time to figure out the php internals (in C...)
On Sat, Apr 23, 2011 at 4:04 AM, Ben Schmidt
wrote:
> yeah you are right, passing arguments by reference doesn't trigger the
>>
yeah you are right, passing arguments by reference doesn't trigger the
notice, but I'm not sure that it is applicable in our case.
Yeah, it wouldn't help. For instance, 42 or "default" can't be passed by
reference, so you couldn't actually provide a default value to
coalesce() if you implemented
On Fri, Apr 22, 2011 at 12:07 AM, Brian Moon wrote:
> which one?
>> I guess that you are talking about the language constructs like isset and
>> empty.
>> they aren't functions.
>>
>
> settype() for one.
>
> Brian.
>
yeah you are right, passing arguments by reference doesn't trigger the
notice,
which one?
I guess that you are talking about the language constructs like isset and
empty.
they aren't functions.
settype() for one.
Brian.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
On Thu, Apr 21, 2011 at 8:37 PM, Brian Moon wrote:
> I proposed something similar over 5 years ago. It ain't gonna happen
>> because PHP language can't support it.
>>
>
> It supports it. Several functions allow you to pass in variables that are
> not set and don't throw an error. Not sure what yo
I proposed something similar over 5 years ago. It ain't gonna happen
because PHP language can't support it.
It supports it. Several functions allow you to pass in variables that
are not set and don't throw an error. Not sure what you are talking about.
Brian.
--
PHP Internals - PHP Runtime D
On Wed Apr 20 04:41 PM, D. Dante Lorenso wrote:
>
> My proposal was called "filled" since it was the opposite of "empty"
> which already existed. I extended the function to return the first
> non-empty value or null if all values evaluated as empty.
>
> You could use the function like this:
>
On 4/20/11 9:55 AM, Mark wrote:
Hi,
This proposal is for the often called line like this:
$var = isset($_GET['var']) ? $_GET['var'] : '';
Only a shorter and imho a cleaner solution to get the same:
$var = varset($_GET['var']);
The implementation for this in PHP code is this:
# Arg 1 = the varia
On Wed, Apr 20, 2011 at 6:00 PM, Jonathan Bond-Caron wrote:
> On Wed Apr 20 10:55 AM, Mark wrote:
> >
> > function varset($arr, $key, $default = '') { return (isset($arr[$key])
> > ? $arr[$key] : $default); }
> >
> > where the call would be:
> > $var = varset($_GET, 'var');
> >
> > I personally li
On Wed, Apr 20, 2011 at 7:14 PM, Hannes Landeholm wrote:
> This discussion is equivalent to the one that we just had. Read the thread
> "[PHP-DEV] Implicit isset/isempty check on short-ternary operator".
>
>
except that it wouldn't bring new syntax.
ps: please don't top post if everybody else doe
This discussion is equivalent to the one that we just had. Read the thread
"[PHP-DEV] Implicit isset/isempty check on short-ternary operator".
Also the "$var = var_set($_GET['var'], $_POST['var'], 'default');" syntax
you propose would be equivalent to (as per previous discussion):
$var = $_GET[?'
On Wed, Apr 20, 2011 at 11:06:47AM -0500, Brian Moon wrote:
> >It might be nice to extend it such that if the 1st argument is a list then
> >the
> >first in the list which is set is returned, eg:
> >
> > $var = var_set(($_GET['var'], $_POST['var']), 'default');
>
> If that is the usage, I wou
It might be nice to extend it such that if the 1st argument is a list then the
first in the list which is set is returned, eg:
$var = var_set(($_GET['var'], $_POST['var']), 'default');
If that is the usage, I would suggest coalesce() to be consistent with
the same concept in SQL. And y
On Wed Apr 20 10:55 AM, Mark wrote:
>
> function varset($arr, $key, $default = '') { return (isset($arr[$key])
> ? $arr[$key] : $default); }
>
> where the call would be:
> $var = varset($_GET, 'var');
>
> I personally like both ways...
> My proposal is to make this function a core php function
On Wed, Apr 20, 2011 at 05:19:36PM +0200, Mark wrote:
> > If is is a language element (like isset()) then you can avoid this problem.
> >
>
> Could you explain that a bit more?
It looks like a function but is not:
http://uk3.php.net/manual/en/function.isset.php
> > It might be nice to
On Wed, Apr 20, 2011 at 5:12 PM, Alain Williams wrote:
> On Wed, Apr 20, 2011 at 04:55:00PM +0200, Mark wrote:
> > Hi,
> >
> > This proposal is for the often called line like this:
> > $var = isset($_GET['var']) ? $_GET['var'] : '';
> >
> > Only a shorter and imho a cleaner solution to get the sa
On Wed, Apr 20, 2011 at 04:55:00PM +0200, Mark wrote:
> Hi,
>
> This proposal is for the often called line like this:
> $var = isset($_GET['var']) ? $_GET['var'] : '';
>
> Only a shorter and imho a cleaner solution to get the same:
> $var = varset($_GET['var']);
It should be called var_set() - b
Hi,
This proposal is for the often called line like this:
$var = isset($_GET['var']) ? $_GET['var'] : '';
Only a shorter and imho a cleaner solution to get the same:
$var = varset($_GET['var']);
The implementation for this in PHP code is this:
# Arg 1 = the variable to check for existence
# Arg
18 matches
Mail list logo