Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-20 Thread David Muir
On 21/04/11 08:56, Arpad Ray wrote: > On Thu, Apr 14, 2011 at 3:05 PM, Hannes Landeholm wrote: >> Some suggested that the ternary if comparison should suppress the notice >> automatically. This would break existing code and also be confusing since >> people expect a ternary if and normal if to wor

Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-20 Thread Arpad Ray
On Thu, Apr 21, 2011 at 12:56 AM, Arpad Ray wrote: > I've pined for something like coalesce($_GET['foo'], $defaults['foo'], > 42) for years, and I think that style is far more in keeping with the > PHP ethos, and far more readily understandable than this suggested new > syntax. > To elaborate, I'

Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-20 Thread Arpad Ray
On Thu, Apr 14, 2011 at 3:05 PM, Hannes Landeholm wrote: > Some suggested that the ternary if comparison should suppress the notice > automatically. This would break existing code and also be confusing since > people expect a ternary if and normal if to work the same way. > > Some suggested ?? as

Re: [PHP-DEV] Re: Function proposal: varset

2011-04-20 Thread Arpad Ray
On Wed, Apr 20, 2011 at 11:50 PM, Mark wrote: > On Wednesday, April 20, 2011, D. Dante Lorenso wrote: >> 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 solut

[PHP-DEV] Re: Function proposal: varset

2011-04-20 Thread Mark
On Wednesday, April 20, 2011, D. Dante Lorenso wrote: > 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']); > >

Re: [PHP-DEV] Function proposal: varset

2011-04-20 Thread D. Dante Lorenso
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

Re: [PHP-DEV] Function proposal: varset

2011-04-20 Thread Mark
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

Re: [PHP-DEV] Function proposal: varset

2011-04-20 Thread Ferenc Kovacs
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

Re: [PHP-DEV] Function proposal: varset

2011-04-20 Thread Hannes Landeholm
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[?'

[PHP-DEV] PECL: "mysqlnd_ms" (Load-Balancing)

2011-04-20 Thread Reindl Harald
http://pecl.php.net/package/mysqlnd_ms/download/1.0.0/ This is a really great idea to use replication-salves for read-access without touch the php-application and if this will work with "php_flag" site-specific using the available slaves automatically / leave them out if they are stopped this can

Re: [PHP-DEV] Function proposal: varset

2011-04-20 Thread Alain Williams
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

Re: [PHP-DEV] Function proposal: varset

2011-04-20 Thread Brian Moon
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

RE: [PHP-DEV] Function proposal: varset

2011-04-20 Thread Jonathan Bond-Caron
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

Re: [PHP-DEV] Function proposal: varset

2011-04-20 Thread Alain Williams
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

Re: [PHP-DEV] Function proposal: varset

2011-04-20 Thread Mark
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

Re: [PHP-DEV] Function proposal: varset

2011-04-20 Thread Alain Williams
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

[PHP-DEV] Function proposal: varset

2011-04-20 Thread Mark
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

Re: [PHP-DEV] RFC: built-in web server in CLI.

2011-04-20 Thread Richard Quadling
2011/4/20 Johannes Schlüter : > > > On 04/20/11 04:18 PM, Dave Ingram wrote: >> >> On 04/19/11 15:44, Michael Morris wrote: >>> >>> watch ($var) ->  $var is sent to the console on the line this statement >>> is >>> made with the statment "now watching 'var'.. init value "x", and then >>> each >>> t

Re: [PHP-DEV] RFC: built-in web server in CLI.

2011-04-20 Thread Richard Quadling
On 20 April 2011 15:18, Dave Ingram wrote: > On 04/19/11 15:44, Michael Morris wrote: >> watch ($var) -> $var is sent to the console on the line this statement is >> made with the statment "now watching 'var'.. init value "x", and then each >> time it changes it is updated in the console. > Just m

Re: [PHP-DEV] RFC: built-in web server in CLI.

2011-04-20 Thread Johannes Schlüter
On 04/20/11 04:18 PM, Dave Ingram wrote: On 04/19/11 15:44, Michael Morris wrote: watch ($var) -> $var is sent to the console on the line this statement is made with the statment "now watching 'var'.. init value "x", and then each time it changes it is updated in the console. Just my 0.02 as

Re: [PHP-DEV] RFC: built-in web server in CLI.

2011-04-20 Thread Dave Ingram
On 04/19/11 15:44, Michael Morris wrote: > watch ($var) -> $var is sent to the console on the line this statement is > made with the statment "now watching 'var'.. init value "x", and then each > time it changes it is updated in the console. Just my 0.02 as a user, but it strikes me that watch() co

Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-20 Thread Ben Schmidt
On 17/04/11 9:14 AM, Ángel González wrote: Ben Schmidt wrote: $var = $arr['key'] ?? : 'empty'; Also note this is possible with the recent proposal Hannes and I were discussing. It simply looks like $var = $arr?['key'] ?: 'empty'; The ?[ avoids notices and the ?: works as it always has. Ben.

Re: [PHP-DEV] SoapServer::handle some times does not call php_end_ob_buffer

2011-04-20 Thread Konstantin Leboev
On Wed, Apr 20, 2011 at 5:35 PM, Ferenc Kovacs wrote: > please report it as a bug on http://bugs.php.net, its easier to keep track > of the problem if its in there. > http://bugs.php.net/bug.php?id=54575 -- Regards, Konstantin

Re: [PHP-DEV] SoapServer::handle some times does not call php_end_ob_buffer

2011-04-20 Thread Ferenc Kovacs
On Wed, Apr 20, 2011 at 3:29 PM, Konstantin Leboev < konstantin.leb...@gmail.com> wrote: > Hi all, > > In some cases SoapServer::handle does not call php_end_ob_buffer and I can > not call it from php. For example: > > class A { > } > > $s = new SoapServer("wsdl.wsdl"); > $s->setClass("A"); > > ob

[PHP-DEV] SoapServer::handle some times does not call php_end_ob_buffer

2011-04-20 Thread Konstantin Leboev
Hi all, In some cases SoapServer::handle does not call php_end_ob_buffer and I can not call it from php. For example: class A { } $s = new SoapServer("wsdl.wsdl"); $s->setClass("A"); ob_start(); var_dump(ob_get_level()); // int(1) $s->handle(); var_dump(ob_get_level()); // int(2) echo ob_get_cl

Re: [PHP-DEV] RFC: built-in web server in CLI.

2011-04-20 Thread Matthew Weier O'Phinney
On 2011-04-20, Michael Morris wrote: > --e0cb4e43cce199248e04a15872c6 > Content-Type: text/plain; charset=ISO-8859-1 > > Those userland solutions (I've written a few myself) send the output > as part of the html file that is being composed, or they write it to a > file which you then later open up

Re: [PHP-DEV] RFC: built-in web server in CLI.

2011-04-20 Thread Jordi Boggiano
On 20.04.2011 14:24, Johannes Schlüter wrote: > > > On 04/20/11 02:05 PM, Michael Morris wrote: >> This takes advantage of the fact that this CLI client, which >> will*not* be >> running as a daemon, will have an open terminal window for it for as >> long as >> it persists until the process is s

Re: [PHP-DEV] RFC: built-in web server in CLI.

2011-04-20 Thread Johannes Schlüter
On 04/20/11 02:05 PM, Michael Morris wrote: This takes advantage of the fact that this CLI client, which will*not* be running as a daemon, will have an open terminal window for it for as long as it persists until the process is stopped with CTRL-C. Sending output to that terminal window would

Re: [PHP-DEV] RFC: built-in web server in CLI.

2011-04-20 Thread Michael Morris
Those userland solutions (I've written a few myself) send the output as part of the html file that is being composed, or they write it to a file which you then later open up. Which is fine. This takes advantage of the fact that this CLI client, which will *not* be running as a daemon, will have a