| SitePoint Sponsor |





Early optimization for something that really doesn't need to be optimized. If you are concern with speed then you should profile your code and work on the spots that really need to be optimized.
Either way HTTP will slow the application down.
Also I'll like to see the reference to "windows version of PHP has to convert it on the fly"
Not using the DS constant is averagely faster then using it: (Using though the CLI.)
Going though Apache the speed stayed consistent while using the DS constant was sometimes faster sometimes slower.
PHP Code:<?php
$l = 1000;
$t1 = microtime( true );
for ( $i = 0; $i < $l; $i++ ) {
file_get_contents( 'C:/Users/Logic/Documents/d.php' );
}
$t2 = microtime( true );
var_dump( $t2 - $t1 );
$t1 = microtime( true );
for ( $i = 0; $i < $l; $i++ ) {
file_get_contents( 'C:' . DIRECTORY_SEPARATOR . 'Users ' . DIRECTORY_SEPARATOR . 'Logic' . DIRECTORY_SEPARATOR . 'Documents' . DIRECTORY_SEPARATOR .'d.php' );
}
$t2 = microtime( true );
var_dump( $t2 - $t1 )
Kudos to the PHP dev team. If they had waited for PHP 6 to introduce these changes, they would have run the risk of losing a lot of mindshare to Python and Ruby.
As a plus, getting namespaces now means less work to port things over to 6.0 when it's out.
@logic_earth:
I may be mistaken, but I think that outside the command line Windows XP/Vista is equally happy with forward or backslashes, an addition to the NT kernel to make it POSIX-compliant. That would explain your results.
Last edited by ruby-lang; Feb 21, 2008 at 06:49. Reason: typo fix
I'm happy about it. It'll be quite a while before I can use it on any client sites, but for my own applications where I control the server I'm looking forward to getting started with it.




That's an interesting point. I never thought about that as being the reason to these early introductions to such significant new features, but it certainly makes sense, especially with all the buzz about Rails and all it's advanced OOP features. If that's the reason, then kudos to the PHP team for recognizing it and pushing forward.
Stackbox CMS - Full edit-on-page drag-and-drop CMS
Autoridge - Vehicle information & maintenance part numbers
Twitter | Blog | Online Javascript Compressor




Stackbox CMS - Full edit-on-page drag-and-drop CMS
Autoridge - Vehicle information & maintenance part numbers
Twitter | Blog | Online Javascript Compressor
I'm not sure that's their goal; I think it has more to do with getting hosting companies on board quickly and avoiding a repeat of php5's uptake problem than a concerted effort to win back some of the mind share that has been lost to RoR. Fundamentally, PHP's development process is way too conservative for the language to ever gain the types of features that make ruby or python attractive.
If what I heard about Traits and Closures making it into version 6 is right, then PHP is less conservative than Java. It also doesn't need all the metaprogramming tricks other languages need to create domain-specific languages, because hey, it's already a DSL for web programming!
I just wish they'd integrate prepared statements from PEAR into the core libraries. Concatenating SQL with user input is Just Plain Wrong, no matter how many escaping and encoding functions it goes through.





You do know that MySQLi does prepared statements do you not? That has been in 5.x from the start. The problem is, that there aren't enough books and tutorial material available for using prepared statements. In fact I would say that instructional material and documentation for PHP has lagged far worse than the adoption of PHP 5.



Zealotry is contingent upon 100 posts and addiction 200?





My point was, not that I was having difficulty understanding or using them, but that prepared statements are not widely used, because the tutorial material is not widely available. Hence the reason you still see so many new coders using the OLD MySQL extension. I can't remember the last time a new coder came here asking about help with prepared statements in PHP. They haven't caught on because despite various people here recommending them, there isn't enough material on them. A new coder is less likely to use an abstraction, and more likely to use the built-in functions to learn.




I have been using PDO exclusively since PHP 5.1 (1st stable branch of PHP5), and it has been wonderful for my sanity. No more worrying about SQL injection or "Did I escape _ALL_ the input data? Am I really sure I got everything?".
I do agree though that there are not nearly enough tutorials that involve the use of PDO or even ones that involve proper escaping/sanitizing of user input. That momentum is starting to change though as PHP gets more and more advanced features. I look forward to the future.
Stackbox CMS - Full edit-on-page drag-and-drop CMS
Autoridge - Vehicle information & maintenance part numbers
Twitter | Blog | Online Javascript Compressor





That's one thing that I don't understand. I've done plenty of complex projects and though I recognize that it can be hard at times to keep everything in your head, I really don't see how, while coding something, that you could forget to escape input, unless you had a 50 field form you were working with and you were writing 50 lines of escaping, rather than looping through input in a function and doing escaping.
That's a really big if: I know these things have been discussed, but have not seen any indication that they're seriously being considered for inclusion. I personally highly doubt they'll make it into the language, although I would love to be proved wrong. BTW, closures are coming to java, and while java's pace of development may be slow, it's further ahead in the race as it is.
I think it's fairly safe to say that most of my applications won't be affected by PHP 5.3 changes. Although my newest PHP project will most definitely be affected, but I've already started making changes to my code and updating isn't that hard at all.
I welcome this new version, but I am also now wondering what will PHP 6 have that PHP 5.3 doesn't have?
With all the changes in PHP 5.3 how badly will PEAR Classes be broken by the changes?



Fatal error: Class 'NS1' not found in namespace1.php on line 15
Code PHP:phpinfo(1); function __autoload( $classname ) { //$classname = strtolower( $classname ); $classname = str_replace( '::', DIRECTORY_SEPARATOR, $classname ); require_once( dirname( __FILE__ ) . '/' . $classname . '.php' ); } //use NS1; NS1::test();
NS1.php
Code PHP:<?php namespace NS1; function test() { echo '__ALL__'; }
![]()
Off Topic:
I'm curious why in the above image you censored data that isn't sensitive...not even remotely sensitive...
If you hid anything should have been "Windows NT" + "5.1 build 2600" as this tells me you are running the first release of Windows XP. But you hid the computer name and the drive letter the php.ini file is on...hmmm
Heh and you left C:\WINDOWS clear...so very curious why you censored portions of it now
Bookmarks