
threeZ
Members-
Posts
12 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by threeZ
-
Re: [FAQ] How to populate HTML elements with PHP how's this for conclusive... i've seperated both snippets and timed php.exe executing both of them. <?php $t1 = microtime(true); system('C:/php5/php.exe C:/www/test.php'); $t2 = microtime(true); $r = $t2 - $t1; echo 'threeZ: '. $r; $t1 = microtime(true); system('C:/php5/php.exe C:/www/test_echo.php'); $t2 = microtime(true); $r = $t2 - $t1; echo 'Spudinski: '. $r; ?> result: threeZ: 2.9573328495026 Spudinski: 3.3081579208374 EDIT: Spud's responce -> testing on my local machine: IntelĀ® Core2 CPU T5300 @ 1.73GHz 1.73 GHz, 2.00 GB of RAM and no "php addons" test.php <?php $array = array(); for($i=1; $i<=300; $i++) $array[] = array('id' => $i, 'name' => 'name' . $i); ?> <select name="flowers" onchange="document.forms[0].post()"> <option disabled="disabled">Flowers</option> <?php foreach($array as $flower) { echo '<option value="' . $flower['id'] . '">' . $flower['name'] . '</option>'; } ?> </select> test_echo.php <?php $array = array(); for($i=1; $i<=300; $i++) $array[] = array('id' => $i, 'name' => 'name' . $i); echo '<select name="flowers" onchange="document.forms[0].post()">'; echo '<option disabled="disabled">Flowers</option>'; foreach($array as $flower) { echo '<option value="' . $flower['id'] . '">' . $flower['name'] . '</option>'; } echo '</select>'; ?> anyways, as stated on the IRCd.. im done proving myself and i'm done with this forum. it was nice but, meh the argument has gone from "threeZ is wrong" to "why would you want to do that anyway?!". pick a side and stick to it..and when you're proven wrong -> admit to it plz, have a little bit of character. im out.
-
Re: [FAQ] How to populate HTML elements with PHP umm, i don't believe you went about that quite correct :) 0.000747 vs. 0.000639 difference of 0.000108 in threeZ's favor 0.000757 vs. 0.000646 difference of 0.000111 in threeZ's favor 0.000736 vs. 0.000633 difference of 0.000103 in threeZ's favor might have to refresh once or twice to see the difference 18/20 times "my" method is faster. granted we are speaking very small increments but, with larger snippets = larger results etc. <?php $array = array(); for($i=1; $i<=300; $i++) $array[] = array('id' => $i, 'name' => 'name' . $i); $t1 = explode(' ', microtime()); echo '<select name="flowers" onchange="document.forms[0].post()">'; echo '<option disabled="disabled">Flowers</option>'; foreach($array as $flower) { echo '<option value="' . $flower['id'] . '">' . $flower['name'] . '</option>'; } echo '</select>'; $t2 = explode(' ', microtime()); $r1 = $t2[0] - $t1[0]; ?> <?php $t3 = explode(' ', microtime()); ?> <select name="flowers" onchange="document.forms[0].post()"> <option disabled="disabled">Flowers</option> <?php foreach($array as $flower) { echo '<option value="' . $flower['id'] . '">' . $flower['name'] . '</option>'; } ?> </select> <?php $t4 = explode(' ', microtime()); $r2 = $t4[0] - $t3[0]; $d = ( ($r1 > $r2) ? $r1 - $r2 : $r2 - $r1 ); echo ' '. $r1 .' vs. '. $r2 .' difference of '. $d .' in [b]'. ( ($r1 > $r2) ? 'threeZ' : 'Spudinski' ) .'[/b]\'s favor '; ?>
-
Re: [FAQ] How to populate HTML elements with PHP sorry but your example provides no relevancy to the argument. you can't str_repeat(); <select> 1000 times. Simply, your server and php installation can parse html faster when presented in "raw" format than echoed via php. Logically: html -> php -> apache echo ("<table><tr><td>"); opposed to: html -> apache <table><tr><td>
-
Re: [FAQ] Email Validation in PHP result would be the same. very untrue. theoretically, no. again: scope of snippet... Comments: this is an awkward way to reply getmxrr(); -> very good point out. my retort was based on the supplied code :) in responce to "one wonders how many people from nasa.gov we are going to get" -> probably as many as you would get for the need to validate an mx record. if everyone used a valid address there would be no need ;)
-
Re: [FAQ] Email Validation in PHP you're trying to prove a point ( that im wrong ) and im trying to express my opinion. verywell: you still didn't address two big points of mine 1 ) automatic validation upon @google.com, @microsoft.com, @abcd.com, @nasa.gov 2 ) exec(); not enabled really there's nothing you can do about either situation. maybe a filter ( not the best solution to anything ) or maybe curl/wget/file_get_content some unreliant site for a mx lookup IN MY OPINION: as previously stated, i believe it would be more load efficient to just send the email, and await bounceback than validate the mx record ( which could validate anything ), send the email, then await bounceback. wouldn't you give the user the option to change their registered email via the options within the game. also, you're going outside the scope of the provided snippet -> email validation upon registration.
-
Re: [FAQ] How to populate HTML elements with PHP why don't you try benchmarking the two ;)
-
Re: [FAQ] Email Validation in PHP my statement was reliant on a small user base. yes, if your sending out 15,000 emails: you'd probably want some protection. considering this is a php-gaming community, the snippet at hand was to validate email addresses ( one could assume for registration ); i don't know of any php-game that has 15,000 users signing up at once. in addition, if you wanted to take it a step further, what if someone signed up with @google.com or @microsoft.com or @abcd.com -> all would validate but, chances of someone having those emails is very unlikely; which would also cause bouncebacks, so it's kinda a loss-loss. imo, instead of preforming double the work to validate, mail(); then possibly receive bounceback, it would be more optimal to simply mail(); has have the possibility to bounceback. just my opinion :-)
-
Re: [FAQ] How to populate HTML elements with PHP good example. but just as a heads up, you can insert raw html within your php files :) example: <select name="flowers" onchange="document.forms[0].post()"> <?php $sql_text = 'SELECT `id`, `name` FROM `flowers` ORDER BY `name` DESC'; // Execute the query $query = mysql_query($sql_text); // To solve a bug where you cannot select the first element echo '<option disabled="disabled">' . mysql_num_rows($sql_txt) . ' Flowers</option>'; // Loop trough the results while($flower = mysql_fetch_assoc($query)) { // Echo the results out into option elements echo '<option value="' . $flower['id'] . '">' . $flower['name'] . '</option>'; } ?> </select> your host and php installation will thank you :wink:
-
Re: [FAQ] Email Validation in PHP just an interjection -> there's really no point in checking the mx record if your sending an email validation to the user anyway. if they put a false email they obviously won't be able to verify it. in addition to exec(); not being enabled on all hosts, mail uses less load :)
-
Re: No Crons or you could check this out... http://phpjobscheduler.co.uk works like a champ