Re: [PHP] Question concerning performance
On Wednesday 17 January 2001 11:37, jeremy wrote: Example ONE: (in just parse mode) [cut]--- ? print "html-tagblah blah blah blah blah blah blah/html-tag"; print "html-tag" . $Var1 . "/html-tagb-tag" . $Var2 . "/b-tag"; ? [/cut]-- Example TWO: (in html parse mode) [cut]--- html-tagblah blah blah blah blah blah blah/html-tag html-tag?=$Var1;?/html-tagb-tag?=$Var2;?/b-tag [/cut]-- Now, let me elaborate. I'm quite aware that the above 2 code segments will both be fast enough for me not to care. BUT, within an application that has 1000 lines of code per page (hypothetically), everything begins to matter, and the more cpu-clicks I can save, the happier I'll be. With big applications the *main* thing that matters is maintainability. In other words: Make it work, make it work well, make it maintainable and *then* make it as fast as possible while *keeping* it maintainable (and working of course) The 2 examples will turn out the same results to the browser, but which will do it faster? Don't care about it. The difference is most lileky in th 0.1% range. Look at bigger optimizations first, then benchmark and if it still is too slow (and only then) optimize further. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka", but "That's funny..." - Isaac Asimov -- 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] How to handle multiple lines in PHP?
On Tuesday 16 January 2001 17:12, david klein wrote: Does anyone know how to handle this? One idea is to convert the END OF LINE CHAR to "BR" before putting it into the database, but how can we detect the END OF LINE CHAR in PHP? Or is there any other ways? Search the list archives. I already posted a solution for this (complete, working source code) some time ago. Here it is: Date: Fri, 5 Jan 2001 18:08:51 +0100 -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) "Never doubt that a small group of thoughtful, committed people can change the world... Indeed, it's the only thing that ever has." - Margaret Mead -- 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] regular expression
On Monday 15 January 2001 09:03, Fai wrote: ^.+@.+\\..+$ This regular expression can check if the email address is valid. But it cannot validate the email address with two "@", does I use this code: /* * Check whether the supplied string is a * (syntactically) valid email address * Only does a very rough check. Checking for complete * validity is nearly impossible. */ function pbIsMailAddress ($Address) { // strip comments while (preg_match ('/\([^()]*\)/', $Address)) $Address = preg_replace ('/\([^()]*\)/', '', $Address); // strip leading/trailing whitespace $Address = trim ($Address); // check for basic form return preg_match ('/^[^@]+@[\w-]+(\.[\w-]+)+$/', $Address); } -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) "Software is like sex: the best is for free" -- Linux Torvalds -- 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] filemtime or getlastmod
On Sunday 14 January 2001 17:54, Christian Binder wrote: The only problem is, that my following script only shows one date (IMO: of the first value (.)), and not create the date of each file. // get unix-timestamp form each file in subdirectory $unixdatum=getlastmod($datei[$i]); Read again through the getlastmod() docs. That function returns the modification time of the *currently executed PHP script*. Use filemtime() instead and it will work -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Install once, run forever. Linux. -- 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] mixing HTML and PHP code
On Friday 12 January 2001 00:26, [EMAIL PROTECTED] wrote: echo "html"; echo "head"; echo "title$title/title"; echo "link rel='stylesheet' type='text/css' [...] if ($time_to_write_the_web_page) { // write the web page. echo " html head title$title/title "; One reason why I don't like the "echo" route: I lose the syntax highlighting for the HTML that way. String constants should be highlighted as, well, string constants normally, but when they contain HTML code that's just plain ugly. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Pretty cool, the kind of power information technology puts in our hands these days. - Securityfocus on probing 3600 hosts for known problems in 3 weeks -- 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 simulator
On Thursday 11 January 2001 00:08, Todd Cary wrote: Did I completely miss the point? Yes and No. I have my Win 2K system in my office on which I do PHP development. However, sometimes I am on the road with a "simple" Notebook computer (450 MHz and 6 GHz drive). It would be nice to "play around" with PHP and see if it will run. *simple* I have PHP running nicely on a Pentium 90 with 48MB RAM which also happens to be the file-/mail-/smb-/cvs-/... server in my house. So don't worry about your "simple" notebook being too slow :) (granted - that computer here runs on Linux without any GUI, but still...) -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) This is JohnC IMHO, I compaired tri-word groupings here and in his plan and got a good match. - /. posting discussing the likelihood that an AC post that claimed to be posted by John Carmack during his honeymoon (and having the login info at home) was actually from him. -- 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] MySQL SELECT performance suggestions
On Wednesday 10 January 2001 20:58, [EMAIL PROTECTED] wrote: I have PHP perform SELECT queries on the table, and I need to display the results in a format of: "viewing $top to ($top+$depth) of $numrows found" I haven't found a way to determine $numrows without performing a second SELECT in this format: look for mysql_num_rows () -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Drink wet cement. Get stoned. -- 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]