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
mail_ben_schm...@yahoo.com.auwrote:
yeah you are right, passing arguments by
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 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:
$x =
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
On Thu, Apr 21, 2011 at 8:37 PM, Brian Moon br...@moonspot.net 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
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 Fri, Apr 22, 2011 at 12:07 AM, Brian Moon br...@moonspot.net 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
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
#
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() - better
On Wed, Apr 20, 2011 at 5:12 PM, Alain Williams a...@phcomp.co.uk 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
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 extend
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 in PHP
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
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 would suggest
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 =
On Wed, Apr 20, 2011 at 7:14 PM, Hannes Landeholm landeh...@gmail.comwrote:
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
On Wed, Apr 20, 2011 at 6:00 PM, Jonathan Bond-Caron jbo...@openmv.comwrote:
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
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
Thanx guys for the advices
Respect...
Ante
Marcus Boerger wrote:
Hello AnteD,
Friday, May 13, 2005, 1:29:36 PM, you wrote:
Hi guys...
Yes I know that this is a small function and yes I know it can be
copy-paste with every new project you do but from the first day I've
been using
Hi guys...
Yes I know that this is a small function and yes I know it can be
copy-paste with every new project you do but from the first day I've
been using PHP until today this function follows me everywhere and I now
that everyone is using it one way or the other for debugging..
the
Hmm, it's no GOTO, but oddly enough we have virtually exactly the same
function and use it everywhere too. The only differences are we call ours
pre_r() and we add the following check against php_sapi_name() so that the
function behaves sanely when called from the cli:
function pre_r($mixed,
AnteD wrote:
Yes I know that this is a small function and yes I know it can be
copy-paste with every new project you do but from the first day I've
been using PHP until today this function follows me everywhere and I now
that everyone is using it one way or the other for debugging..
...
The
On Friday 13 May 2005 14:29, AnteD wrote:
Hi guys...
Yes I know that this is a small function and yes I know it can be
copy-paste with every new project you do but from the first day I've
been using PHP until today this function follows me everywhere and I now
that everyone is using it one
On Mon, 16 May 2005, Sean Coates wrote:
AnteD wrote:
Yes I know that this is a small function and yes I know it can be copy-paste
with every new project you do but from the first day I've been using PHP
until today this function follows me everywhere and I now that everyone is
using it
Yes I know that this is a small function and yes I know it can be
copy-paste
with every new project you do but from the first day I've been using
PHP
until today this function follows me everywhere and I now that
everyone is
using it one way or the other for debugging..
...
Hello AnteD,
Friday, May 13, 2005, 1:29:36 PM, you wrote:
Hi guys...
Yes I know that this is a small function and yes I know it can be
copy-paste with every new project you do but from the first day I've
been using PHP until today this function follows me everywhere and I now
that
Hello,
yes ? no ? perhaps ? something ? :-)
- Original Message -
From: Frédéric LECOINTRE [EMAIL PROTECTED]
To: internals@lists.php.net
Sent: Friday, February 25, 2005 5:12 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
| Hello,
|
| After tests, I did'nt note
PROTECTED]
Cc: internals@lists.php.net
Sent: Tuesday, February 22, 2005 3:20 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
| Hello all,
|
| thanks John for help
|
| so here, http://php-dev.burnweb.net.
| there's new diff to avoid unexpected end of script on fatal error.
| (add
Coggeshall [EMAIL PROTECTED]
To: Marcus Boerger [EMAIL PROTECTED]
Cc: Frédéric LECOINTRE [EMAIL PROTECTED];
internals@lists.php.net
Sent: Monday, February 21, 2005 11:45 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
| On Mon, 2005-02-21 at 17:07, Marcus Boerger wrote:
| I
Hello Marcus,
| have you experimented with php_check_syntax() and temporairy streams?
tell me if i'm wrong.
I think it could be possible to use php_lint_script and do compiler read
variable instead of file
- set zend_file_handle-type = ZEND_HANDLE_STREAM
- define two functions for reader and
Hello Frédéric,
Monday, February 21, 2005, 1:56:01 PM, you wrote:
Hello Marcus,
| have you experimented with php_check_syntax() and temporairy streams?
tell me if i'm wrong.
I think it could be possible to use php_lint_script and do compiler read
variable instead of file
- set
:17 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
| Hi Fred,
|
| this patch doesn't just check wether the string has the right syntax but
| also compiles it and registers it's functions and classes in the relevant
| tables.
|
| $ sapi/cli/php -r
Hello Marcus,
Sunday, February 20, 2005, 6:32:57 AM, you wrote:
MB what happend to defines (when redefining)
define() is called at run-time, as far as i saw, so there should be no
problems with it
MB and what happens to __autoload()?
well, i never used it myself, so i've never
Hello val,
Sunday, February 20, 2005, 5:59:21 PM, you wrote:
Hello Marcus,
Sunday, February 20, 2005, 6:32:57 AM, you wrote:
MB what happend to defines (when redefining)
define() is called at run-time, as far as i saw, so there should be no
problems with it
MB and what happens to
Boerger [EMAIL PROTECTED]
To: val khokhlov [EMAIL PROTECTED]
Cc: internals@lists.php.net
Sent: Sunday, February 20, 2005 6:05 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
| Hello val,
|
| Sunday, February 20, 2005, 5:59:21 PM, you wrote:
|
| Hello Marcus,
|
| Sunday
PHP_Parser would be a
reasonable solution
fred
- Original Message -
From: Marcus Boerger [EMAIL PROTECTED]
To: val khokhlov [EMAIL PROTECTED]
Cc: internals@lists.php.net
Sent: Sunday, February 20, 2005 6:05 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
| Hello
in Smarty_Compiler.class.php#144-164 with
limitations)
fred
- Original Message -
From: Johannes Schlueter [EMAIL PROTECTED]
To: internals@lists.php.net
Sent: Friday, February 18, 2005 1:17 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
| Hi Fred,
|
| this patch doesn't just check
I guess swapping out the compiler and executer globals before /after the
compile call wont work?
egs = executor_globals
cgs = compiler_globals
compile_string / file etc.
efree(executor_globals);
efree(compiler_globals);
executor_globals = egs;
compiler_globals = cgs;
obviously if this is the
Hello Frédéric,
do you have some c code you can post here as a .txt attachment or as a link?
regards
marcus
Friday, February 18, 2005, 4:41:06 AM, you wrote:
hi all,
to check syntax of pieces of code and to avoid wild regular expressions, i
wrote this:
proto bool
Hello Marcus,
Based on 5.0.3 source distribution, inspired of parsekit_compile_string
fred
- Original Message -
From: Marcus Boerger [EMAIL PROTECTED]
To: Frédéric LECOINTRE [EMAIL PROTECTED]
Cc: internals@lists.php.net
Sent: Friday, February 18, 2005 9:25 AM
Subject: Re: [PHP-DEV
-DEV] function proposal - php_check_syntax_string
| Hello Frdric,
|
| do you have some c code you can post here as a .txt attachment or as a
link?
|
| regards
| marcus
|
| Friday, February 18, 2005, 4:41:06 AM, you wrote:
|
| hi all,
|
| to check syntax of pieces of code
(or something else) instead of removing the
introduced code?
fred
- Original Message -
From: Johannes Schlueter [EMAIL PROTECTED]
To: internals@lists.php.net
Sent: Friday, February 18, 2005 1:17 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
| Hi Fred
Hello Johannes,
Friday, February 18, 2005, 2:17:12 PM, you wrote:
JS this patch doesn't just check wether the string has the right syntax but
JS also compiles it and registers it's functions and classes in the relevant
JS tables.
well, they need to add this code to avoid it:
in
zend_language_scanner.c (or something else) instead of removing the
introduced code?
fred
- Original Message -
From: Johannes Schlueter [EMAIL PROTECTED]
To: internals@lists.php.net
Sent: Friday, February 18, 2005 1:17 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
| Hi Fred
Hi,
Frdric LECOINTRE wrote:
oups ... well.
php_check_syntax works fine with zend_compile_file. so what's the
No, it doesn't work fine, too :-)
http://bugs.php.net/bug.php?id=27406
But I didn't know the problem either when reading your patch where I
stumbled over the compile_string() call.
Is there possibilty to run syntax check only with compil_string in
zend_language_scanner.c (or something else) instead of removing the
introduced code?
No. At least I don't know a how (but I don't know everything about the
engine) The only thing I currently can think of is using the
hi all,
to check syntax of pieces of code and to avoid wild regular expressions, i
wrote this:
proto bool php_check_syntax_string(string string [, $error_message])
like php_check_syntax but on string
it will be useful for applications who have to store valid code like smarty,
...
is it possible
On Sun, Mar 07, 2004 at 01:07:08PM -0500, Louis-Philippe Huberdeau wrote :
/* {{{ proto string nl2p(string str)
Converts newlines to HTML paragraphs for standard compliance */
I'm not to judge whether this goes in or not, however using
paragraphs is not more standard compliance than
On Sun, Mar 07, 2004 at 01:07:08PM -0500, Louis-Philippe Huberdeau wrote:
I wrote this very simple function (modification from nl2br actually) to
convert newlines to well formatted HTML paragraphs instead of line
breaks, allowing better formatting of a dynamic output. It's not the
most
On Sunday 07 March 2004 21:58, Stefan Walk wrote:
On Sun, Mar 07, 2004 at 01:07:08PM -0500, Louis-Philippe Huberdeau wrote:
I wrote this very simple function (modification from nl2br actually) to
convert newlines to well formatted HTML paragraphs instead of line
breaks, allowing better
Intresting for users that need such functions on several places in code
and in
this case better as regexp in PHP itself. Why not take this ideas and put
together into ext/html(format)?
I agree with the statement that functions like these (and nl2br() itself)
don't really belong in the PHP
I wrote this very simple function (modification from nl2br actually) to
convert newlines to well formatted HTML paragraphs instead of line
breaks, allowing better formatting of a dynamic output. It's not the
most perfect piece of code ever written, but it works and it can be
quite useful.
The
52 matches
Mail list logo