Re: [PHP-DEV] Real world database statistics for phpBB3
On Mon, Jul 20, 2009 at 11:28 AM, Cristian Rodríguez crrodrig...@suse.dewrote: On 20/07/09 04:05, Alexander Hjalmarsson wrote: If there's anyone here that might be able to help in this subject it's very welcome. PHPBB has absolutely nothing to do with this list. This is a part of the Better Benchmarks RFChttp://wiki.php.net/rfc/better_benchmarksWhere we create a benchmark of Real world PHP applications. Check out the section Applications which could make good web-app benchmarkshttp://wiki.php.net/rfc/better_benchmarks#applications_which_could_make_good_web-app_benchmarks
Re: [PHP-DEV] Re: Flexible type hinting
On Thu, Jul 2, 2009 at 9:09 PM, Ryan Panning rpann...@gmail.com wrote: Ford, Mike wrote: function func(int $i) for strict type checking, and function func((int)$i) for coercion aka casting (although now I've seen it written down I'm not so sure! ;). Just want to throw my 2 cents in. Big +1 for this syntax I think with the addition of this and __cast() for objects, PHP's OO will be very flexible and can build great Frameworks, ORM's, etc. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php function($quantity) function(int $quantity) STRICT type function(?int $quantity) Thought id throw it out there. Interesting discussion though. Ólafur
Re: [PHP-DEV] Re: PHP 5.3.0 Released!
Congratulations :) On Tue, Jun 30, 2009 at 1:25 PM, Rodrigo Saboya rodrigo.sab...@bolsademulher.com wrote: Lukas Kahwe Smith wrote: Hello! The PHP Development Team would like to announce the immediate release of PHP 5.3.0. This release is a major improvement in the 5.X series, which includes a large number of new features and bug fixes. Release Announcement: http://www.php.net/release/5_3_0.php Downloads:http://php.net/downloads.php#v5.3.0 Changelog:http://www.php.net/ChangeLog-5.php#5.3.0 regards, Johannes and Lukas Great news :) But I think the changelog link is broken =P Regards Rodrigo Saboya -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] APM
Wheels were made to be reinvented! Or else we'd all be using stone wheels.
Re: [PHP-DEV] The constant use of isset()
2009/5/12 Ionut Gabriel Stan ionut.g.s...@gmail.com 2009/5/13 Ólafur Waage olaf...@gmail.com: 2009/5/12 Brian Moon br...@moonspot.net $foo = filter_input(INPUT_GET, foo, FILTER_UNSAFE_RAW); That would have a value if set or null if not set. It also allows you to validate it using filters if you wanted to. This of course only works with GPC variables, but it is a great solution. Brian. http://brian.moonspot.net/ Can this be turned into a userland function? If you're interested in userland code, then you have two solutions: 1. Make functions like GET, POST, COOKIE, SESSION and use them instead of the superglobals (functions are superglobal). An example: // PHP 5.3 function GET($key, $default = null) { return isset($_GET[$key]) ? $_GET[$key] : $default; } // PHP = 5.3 function GET($key, $default = null) { return isset($_GET[$key]) ?: $default; } 2. Use ArrayObject to override the superglobals in an auto_prepend_file: - $_GET = ArrayObject($_GET); Anyway, these will save the trouble with the superglobals, not with ordinary arrays. Yes this will work with GPC variables but not with any other variable. And passing values to it even feels right. if(GET(foo) == bar) Olafur On 5/12/09 11:35 AM, Ólafur Waage wrote: While researching for this suggestion I found this rfc proposal regarding ifsetor() ( http://wiki.php.net/rfc/ifsetor?s[]=issethttp://wiki.php.net/rfc/ifsetor?s%5B%5D=isset http://wiki.php.net/rfc/ifsetor?s%5B%5D=isset) and it's rejection point was that it was currently not possible ( http://marc.info/?l=php-internalsm=108931281901389w=2 ) But would it be possible to check for a value of a variable if it is set? Since I often do (and see others do) if(isset($_GET[foo]) $_GET[foo] == bar) or even worse if((isset($_GET[foo]) $_GET[foo] == bar) || (isset($_GET[baz]) $_GET[baz] == bat)) to be able to do something like this if(isset($_GET[foo]) == bar) or if(isset($_GET[foo]) == bar || isset($_GET[baz]) == bat) That isset (or some other language construct) would return the variable if it were set and false if it was not. Thanks for your time, i know this has probably been talked to death in one form or other. Ólafur Waage olaf...@gmail.com -- Ionut G. Stan I'm under construction | http://igstan.blogspot.com/
[PHP-DEV] The constant use of isset()
While researching for this suggestion I found this rfc proposal regarding ifsetor() ( http://wiki.php.net/rfc/ifsetor?s[]=issethttp://wiki.php.net/rfc/ifsetor?s%5B%5D=isset) and it's rejection point was that it was currently not possible ( http://marc.info/?l=php-internalsm=108931281901389w=2 ) But would it be possible to check for a value of a variable if it is set? Since I often do (and see others do) if(isset($_GET[foo]) $_GET[foo] == bar) or even worse if((isset($_GET[foo]) $_GET[foo] == bar) || (isset($_GET[baz]) $_GET[baz] == bat)) to be able to do something like this if(isset($_GET[foo]) == bar) or if(isset($_GET[foo]) == bar || isset($_GET[baz]) == bat) That isset (or some other language construct) would return the variable if it were set and false if it was not. Thanks for your time, i know this has probably been talked to death in one form or other. Ólafur Waage olaf...@gmail.com
Re: [PHP-DEV] The constant use of isset()
The error suppression was discussed in the rfc and yes it is not clean and you could be suppressing something else inadvertently. Yes the false value would be an issue with this, but for 0, empty array and empty string is an issue with just about anything else in PHP already. Hence === if you want to be strict with it. 2009/5/12 Olivier B. php-dev.l...@daevel.net So if the variable is set and contains false, we can't check it ? And near same problem for 0, empty array and empty string. But you can also use this syntax : (yes it's not very clean) if( @$_GET['foo'] === 'bar') or if( @$_GET['foo'] === 'bar' or @$_GET['baz'] === 'bat' ) Olivier Ólafur Waage a écrit : While researching for this suggestion I found this rfc proposal regarding ifsetor() ( http://wiki.php.net/rfc/ifsetor?s[]=issethttp://wiki.php.net/rfc/ifsetor?s%5B%5D=isset http://wiki.php.net/rfc/ifsetor?s%5B%5D=isset) and it's rejection point was that it was currently not possible ( http://marc.info/?l=php-internalsm=108931281901389w=2 ) But would it be possible to check for a value of a variable if it is set? Since I often do (and see others do) if(isset($_GET[foo]) $_GET[foo] == bar) or even worse if((isset($_GET[foo]) $_GET[foo] == bar) || (isset($_GET[baz]) $_GET[baz] == bat)) to be able to do something like this if(isset($_GET[foo]) == bar) or if(isset($_GET[foo]) == bar || isset($_GET[baz]) == bat) That isset (or some other language construct) would return the variable if it were set and false if it was not. Thanks for your time, i know this has probably been talked to death in one form or other. Ólafur Waage olaf...@gmail.com
Re: [PHP-DEV] The constant use of isset()
On Tue, May 12, 2009 at 5:39 PM, Robert Cummings rob...@interjinn.comwrote: On Tue, 2009-05-12 at 18:23 +0100, Lewis Wright wrote: Regarding ifsetor, what's wrong with just using this: isset($myvar) OR $myvar = 'i am set'; It works in just the same way and has no problems. I agree it would be great though if there could be a function to retrieve a variable's value if it exists, without throwing an error if it doesn't exist. I'm not sure if isset would be appropriate though. Lewis. mixed value_of( $variable [, $defaultValue=null] ); ?php if( value_of( $_GET['action'] ) == 'edit' ) { // ... } switch( value_of( $_GET['action'], 'details' ) ) { case 'details': ... } ? Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP Will this run without notices if the value you are passing to the function isnt set? Olafur
Re: [PHP-DEV] The constant use of isset()
2009/5/12 Brian Moon br...@moonspot.net $foo = filter_input(INPUT_GET, foo, FILTER_UNSAFE_RAW); That would have a value if set or null if not set. It also allows you to validate it using filters if you wanted to. This of course only works with GPC variables, but it is a great solution. Brian. http://brian.moonspot.net/ Can this be turned into a userland function? Olafur On 5/12/09 11:35 AM, Ólafur Waage wrote: While researching for this suggestion I found this rfc proposal regarding ifsetor() ( http://wiki.php.net/rfc/ifsetor?s[]=isset http://wiki.php.net/rfc/ifsetor?s%5B%5D=isset) and it's rejection point was that it was currently not possible ( http://marc.info/?l=php-internalsm=108931281901389w=2 ) But would it be possible to check for a value of a variable if it is set? Since I often do (and see others do) if(isset($_GET[foo]) $_GET[foo] == bar) or even worse if((isset($_GET[foo]) $_GET[foo] == bar) || (isset($_GET[baz]) $_GET[baz] == bat)) to be able to do something like this if(isset($_GET[foo]) == bar) or if(isset($_GET[foo]) == bar || isset($_GET[baz]) == bat) That isset (or some other language construct) would return the variable if it were set and false if it was not. Thanks for your time, i know this has probably been talked to death in one form or other. Ólafur Waage olaf...@gmail.com
Re: [PHP-DEV] PHP: 'Microsoft Build Tools'?
You'll need Visual studio to build PHP from source, but there are prebuilt binaries available here: http://windows.php.net/ On Sun, Feb 8, 2009 at 12:08 AM, Marcus Young marcu...@gmail.com wrote: Hi Internals, do you have some time to help me out? *Quoit the PHP readme* The Win32 Build System. $Id: README.WIN32-BUILD-SYSTEM,v 1.4 2003/12/23 02:51:18 wez Exp $ * 1.* How to build PHP under windows * a.* Requirements - Microsoft Build Tools from: Microsoft Visual Studio (VC6) or later Microsoft Build Tools? Is this a .exe file on the Microsoft site? Do I need to Install all of Microsoft Visual Studio to use PHP? I'm a bit lost here, Thanks for your time. Marcus
[PHP-DEV] Is Empty functionality to the Directory Functions
This is my 1st suggestion to the internals :) Anywho, there has been some discussion in the is_dir() comments on php.net (http://is.php.net/manual/en/function.is-dir.php) about a function that returns bool if a directory is empty or not. Just throwing it out there if it should be implemented to the current list of Directory Functions. $dir = dir(/foo/bar); var_dump($dir-empty()); // bool(true) Ólafur Waage olaf...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Is Empty functionality to the Directory Functions
Yes the SPL directory listing has more functionality but not the one i am talking about. It's not something crucial but useful while iterating through directories. Oh and I should to sit down over the holidays and write examples for the SPL Directory functions and send over to the documentation team. Ólafur Waage olaf...@gmail.com On Wed, Dec 17, 2008 at 10:48 PM, Cristian Rodríguez crrodrig...@suse.de wrote: Ólafur Waage escribió: $dir = dir(/foo/bar); var_dump($dir-empty()); // bool(true) Use SplDirectoryIterator instead. -- We have art in order not to die of the truth - Friedrich Nietzsche Cristian Rodríguez R. Platform/OpenSUSE - Core Services SUSE LINUX Products GmbH Research Development http://www.opensuse.org/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Ternary operator optimization tip
Time: $arr = range(0, 100); // 0.6367609500885 $foo == true ? $foo = $arr : NULL; // 3.0994415283203E-06 if (true) $foo = $arr; else $foo = NULL; // 2.8610229492188E-06 PHP 5.1.6 Olafur Waage On Sun, Dec 14, 2008 at 9:30 PM, David Grudl da...@grudl.com wrote: Původní zpráva Od: Ilia Alshanetsky i...@prohost.org While it is slower due to the use of temp vars, in my experience unless you have a few hundred operations involving ternary operator you cannot even see the difference. Even then there are typically way more important areas of code that need to be optimized. The only time you can really tell its slower is in synthetic benchmarks. Few hundred operations involving ternary operator is nothing unusual ;) Původní zpráva Od: Alexey Zakhlestin indey...@gmail.com On Sun, Dec 14, 2008 at 8:06 PM, David Grudl da...@grudl.com wrote: Do you have any numbers? $arr = range(0, 100); // very very huge array $foo = true ? $arr : NULL; // 140,00 milisec if (true) $foo = $arr; else $foo = NULL; // 0,02 milisec DG. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] alpha2 scheduled
I found that he had one valid question that i would like to see answered. is the below allowed ? $bar = new Module \ Foo \ Bar(); I find it easier to read than with out the space. Since it looks pretty good with the spaces there. 2008/10/27 Johannes Schlüter [EMAIL PROTECTED]: On Tue, 2008-10-28 at 01:43 +1030, Andrew Mason wrote: Both Perl and C++ use :: to success. i don't know how much of an overlap there is in PHP and Perl or C++ programmers, so I'm not suggesting it for familiarity reasons, but i have never heard anyone say i wish C++/ Perl used a different namespace separator. Yes, and as said multiple times: Using :: is impossible and alternatives were discussed multiple times, decision was made with discussions over multiple years now. So please let's move on and in a year or two we won't hear anyone say i wish PHP used a different namespace separator Thanks for no further wasting of time. (neither yours nor mine, ...) (except you find somethign which wasn't discussed within the last 5 yrs) johannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] alpha2 scheduled
$class = '\ foo \ bar \ baz'; In those cases i get why its an issue. But when i look at: namespace\class\method() against namespace \ class \ method() I get the feeling that \ is a pretty good solution. 2008/10/27 Johannes Schlüter [EMAIL PROTECTED]: On Mon, 2008-10-27 at 17:53 +0100, Hannes Magnusson wrote: On Mon, Oct 27, 2008 at 16:50, Ólafur Waage [EMAIL PROTECTED] wrote: I found that he had one valid question that i would like to see answered. is the below allowed ? $bar = new Module \ Foo \ Bar(); I find it easier to read than with out the space. Since it looks pretty good with the spaces there. I don't see why it wouldn't be allowed. You can already do function_name (), or classname:: methodname (). This isn't python, the parser doesn't really care about the spaces :) It might work in some places, not always, consider ?php $class = '\ foo \ bar \ baz'; new $class(); ? as the name is stored without spaces in the class table, not sure whether it's worth parsing whitespaces in such cases... johannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Namespace issues
On an icelandic keyboard \ is AltGr + (key right of 0 in the top row), just an fyi if you guys wanted to know. For my two cents. \ looks like its not supposed to be there. Is there no other combination of two simbols that would work? Like or + or ** or .. or something in that fashion ? Ólafur Waage 2008/10/20 Steph Fox [EMAIL PROTECTED]: The german keyboard issue isn't really one. {}[] are in the same class of characters (alt-Gr + number-row). So, as a programmer, you either have to live with that anyway because there's no avoiding {}[], or you switch to the us layout while programming (which quite a few people do). Also useful to know :) - Steph -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php