Jump to content

Single qoute, double qoute


PJ droopy pants

Recommended Posts

There's really no clear answer. Some people will argue for the single quotes, and some will suggest just the opposite. It also depends on your version of PHP. Either way there's no difference that you'll ever experience so it's really just up to user preference and convenience. For example, if you have a long string containing many double quotes it would be much easier to just use single quotes and avoid having to escape all the other double quotes.

Link to comment
Share on other sites

dont take my word for it, try it for yourself

<?
function microtime_float(){$time = microtime();return (double)substr( $time, 11 ) + (double)substr( $time, 0, 8 );}microtime_float();$starttime=microtime_float();
$ft=10000;
while($ft>0){
?>
<tr><td align="center">Hey whats up</td></tr>
<?
$ft=$ft-1;
}
$endtime=microtime_float();
$totaltime=round($endtime - $starttime,5);
echo $totaltime;
?>

vs

<?
function microtime_float(){$time = microtime();return (double)substr( $time, 11 ) + (double)substr( $time, 0, 8 );}microtime_float();$starttime=microtime_float();
$ft=10000;
while($ft>0){
echo '<tr><td align="center">Hey whats up</td></tr>';
$ft=$ft-1;
}
$endtime=microtime_float();
$totaltime=round($endtime - $starttime,5);
echo $totaltime;
?>

Link to comment
Share on other sites

if theer was no diference why is there suddenly  a way thats 2 times faster? are u making this up as u go?

That's like saying "if you drive a bus 55 mph and you drive a car 55mph taking the same route they get there at the same time but if you take a train at 55mph in a straight line how can you suddenly get ther faster." is there somthign wrong with experimenting? Sorry for trying to find ways to do things faster. Yea I make stuff up just for fun.

Link to comment
Share on other sites

htmlecho ' 'echo " "echo " \" "

0.150480.148530.149320.15578

0.153770.149220.147680.1665

0.151630.148390.147650.14975

0.151110.147960.147450.15073

0.149480.148940.149970.14948

 

lol i thot u meant the same thing i didnt see that it was different combination there hefty

 

slthough now reading your comeback, i do stand by my question.. i mean its called 55 mph for a reason regardless of the vehicle. its a rate. they get there at the same time.

Link to comment
Share on other sites

htmlecho ' 'echo " "echo " \" "

0.150480.148530.149320.15578

0.153770.149220.147680.1665

0.151630.148390.147650.14975

0.151110.147960.147450.15073

0.149480.148940.149970.14948

 

lol i thot u meant the same thing i didnt see that it was different combination there hefty

 

slthough now reading your comeback, i do stand by my question.. i mean its called 55 mph for a reason regardless of the vehicle. its a rate. they get there at the same time.

yes that is why i threw in the 3rd option of the train going a shorter route, :P the third option i was leaving php and rendering static html.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.