Author Topic: HTML Through Paser  (Read 2665 times)

Ragster00

  • Senior Member
  • ****
  • Posts: 499
  • Karma: +0/-0
    • View Profile
    • Help with PHP?
HTML Through Paser
« on: June 07, 2007, 03:37:32 PM »
I can do you one better I will simply paste the code I used here...

PHP Code: [Select]
<?php
$start_time 
microtime();
for(
$i 0$i 11$i++)
{
	
$form "<form action="contactus.php" method="POST">";
	
$form .="
	
<table cellpadding="
4" cellspacing="0" class="main_text">";
	
$form .=" <tr>";
	
$form .="
	
	
	
<td>To:</td>"
;
	
$form .="
	
	
	
<td>"
;
	
$form .="
	
	
	
<select name="
recipent">";
	
$form .="
	
	
	
	
	
	
	
	
<option value="
1">option1</option>";
	
$form .="
	
	
	
	
	
	
	
	
<option value="
2">option2</option>";
	
$form .="
	
	
	
	
	
	
	
	
<option value="
3">option3</option>";
	
$form .="
	
	
	
	
	
	
</select>"
;
	
$form .="
	
	
	
</td>"
;
	
$form .="
	
	
</tr>"
;
	
$form .="
	
	
<tr>"
;
	
$form .="
	
	
	
<td>Name:</td>"
;
	

	
$form .="
	
	
	
<td><input type="
text" name="fname" size="25">";
	
$form .="
	
</tr>"
;
	
$form .="
	
	
<tr>"
;
	
$form .="
	
	
	
<td>Email:</td>"
;
	
$form .="
	
	
	
<td><input type="
text" name="email" size="25">";
	
$form .="
	
	
</tr>"
;
	
$form .="
	
	
<tr>"
;
	
$form .="
	
	
	
<td>Phone:</td>"
;
	
$form .="
	
	
	
<td><input type="
text" name="phone" size="25">";
	
$form .="
	
	
</tr>"
;
	
$form .="
	
	
<tr>"
;
	
$form .="
	
	
	
<td valign="
top">Comments:</td>";
	
$form .="
	
	
	
<td><textarea name="
comment" rows="10" cols="35"></textarea>";
	
$form .="
	
	
</tr>"
;
	
$form .="
	
	
<tr>"
;
	
$form .="
	
	
	
<td colspan="
2" align="center"><input type="submit" name="send" value="Send" class="std_btn">&nbsp;&nbsp;<input type="reset" name="clear" value="Clear" class="std_btn"></td>";
	
$form .="
	
	
</tr>"
;
	
$form .="
	
	
</table>"
;
	
$form .=" </form>";
echo 
"RUN $i: " "<BR><BR><BR>" $form;

}
$end_time =  microtime();
$run_time $end_time $start_time;
echo 
$run_time "- RUNNING HTML THROUGH PASER - <hr>";

$start_time microtime();
for(
$i 0$i 11$i++)
{
?>
	
<form action="contactus.php" method="POST">
	
	
<table cellpadding="4" cellspacing="0" class="main_text">
	
 <tr>
	
	
	
	
<td>To:</td>
	
	
	
	
<td>
	
	
	
	
<select name="recipent">
	
	
	
	
	
	
	
	
	
<option value="1">option1</option>
	
	
	
	
	
	
	
	
	
<option value="2">option2</option>
	
	
	
	
	
	
	
	
	
<option value="3">option3</option>
	
	
	
	
	
	
	
</select>
	
	
	
	
</td>
	
	
	
</tr>
	
	
	
<tr>
	
	
	
	
<td>Name:</td>
	

	
	
	
	
<td><input type="text" name="fname" size="25">
	
	
</tr>
	
	
	
<tr>
	
	
	
	
<td>Email:</td>
	
	
	
	
<td><input type="text" name="email" size="25">
	
	
	
</tr>
	
	
	
<tr>
	
	
	
	
<td>Phone:</td>
	
	
	
	
<td><input type="text" name="phone" size="25">
	
	
	
</tr>
	
	
	
<tr>
	
	
	
	
<td valign="top">Comments:</td>
	
	
	
	
<td><textarea name="comment" rows="10" cols="35"></textarea>
	
	
	
</tr>
	
	
	
<tr>
	
	
	
	
<td colspan="2" align="center"><input type="submit" name="send" value="Send" class="std_btn">&nbsp;&nbsp;<input type="reset" name="clear" value="Clear" class="std_btn"></td>
	
	
	
</tr>
	
	
	
</table>
	
 </form>
	
RUN <? echo $i?> : <BR><BR><BR>
<?php
}
$end_time =  microtime();
$run_time $end_time $start_time;
echo 
$run_time "- NOT RUNNING HTML THROUGH PASER";
?>
-- I do what I can to help! :)
Not all code provided is meant to be a working, error free code. It is meant only as a guide.

Zyppora

  • Global Moderator
  • Senior Member
  • *****
  • Posts: 1401
  • Karma: +0/-0
    • View Profile
(No subject)
« Reply #1 on: June 07, 2007, 04:16:59 PM »
0.687343- RUNNING HTML THROUGH PASER
0.00055- NOT RUNNING HTML THROUGH PASER

Which kinda sucks because IMO in-PHP HTML is more readable (to each their own). BUT the tests not running through the parser didn't finish, they stopped after printing 'RUN 10 : ' for some reason.

But it's quite irrelevant to me, as I store my presentation layer (HTML/JS/CSS) in a MySQL table and pull it out through PHP.
HAVE YOU TRIED DEBUGGING? Example code in this reply deliberately contains BUGS. PHP forum for beginners.