Re: [PHP] What's more effecient: var on every page or simple function?
I'd say the first one, but if you'd use $myvar as a constant only, try this: define(MYVAR,3); Might be even more efficient ;-) btw. You can call this value like this: echo MYVAR; Zef Noah Spitzer-Williams [EMAIL PROTECTED] schreef in berichtnieuws 9dpjiu$5nu$[EMAIL PROTECTED] Which of the two is more efficient: # start of file.php $myvar = 3; # end file.php #start of file.php function myvar() { return 3; } #end file.php the difference between the two is the first example would set the variable on every page regardless of whether it was used whereas with the function obviously it would be used only if it were called. what's better? (myvar is a constant #) - Noah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] still not friends with RegExps..
$string = preg_replace(/[\\\*\+\-;]/s,,$string); I think, you might have to escape the ; too Zef elias [EMAIL PROTECTED] schreef in berichtnieuws 9dr733$knl$[EMAIL PROTECTED] Hello, Maybe RegExps are still my point of weakness...but I still like them as much as I like the Self-Reference phrases... Okay now, how can i replace all the matches of \ , *, +, - and ; with an empty string by calling once the preg_replace() or str_replace() or any string replace function? () Do i have to call it as many times as i got different replacments? -elias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP's OO is bad?
I did some benchmark on how fast variable access is when being used through OOP. And this difference can be up to 1,7 times as slow. I surely hope you can speed up, right now I'm not using it because it's slower... Zef Phil Driscoll [EMAIL PROTECTED] schreef in berichtnieuws [EMAIL PROTECTED] On Sunday 13 May 2001 06:25, Sean Cazzell wrote: certainly not the signigicant slow down that he claims. guessing - haven't done any tests I don't know whether or not what Sterling said is true, but I think that your comment that the difference in speed with a larger program would be less is incorrect in view of your benchmark. Your test does so little that I would imagine that the bulk of the execution time is taken up just by the initialisation and closedown of the request (by browser, apache and php) and the time taken in transit. It *could* be that the OO stuff executed many times more slowly than the non-OO. /guessing - haven't done any tests Cheers -- Phil Driscoll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]