Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread Vincent Vandemeulebrouck
 I have always had the opinion that the more comments you put into php
 scripts, the slower they will run because there is more data to be read...
 Can someone tell me if there is any truth in this or whether commenting
has
 absolutely 'no' impact on the performance of a script?

If the overhead of the parser removing comments becomes an issue for you,
you'll probably be in the situation where your application is heavy, with
thousands of scripts, and a lot of commenting everywhere.

As said before, the comments only impact the parsing. So, you just have to
implement a stripcomment script, that you run when you move your script
from your development server to your production server.

And anyway, this would not be significant, unless you recompile a custom PHP
version where you remove the comment parsing. This would be intereting if
your code was already optimized...

Vincent Vandemeulebrouck


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] FAQ a good idea?

2002-11-22 Thread Vincent Vandemeulebrouck
 An about register globals post bi-weekly would eliminate tons of questions
I
 reckon. But maxim is also right. People should find their own info and a
faq
 could dominate the group...

The fact you must call session_start  before sending anything to the browser
is another FAQ that would help.

An interest of FAQ, is that it helps beginners to find some answers they
need quickly, so they will be more interested in continuing PHP. It helps
making the language even more attractive, because it is a part of the
language support.

An FAQ can also remind the first places where information can be found,
where one should search before asking. So, before someone asks is there a
function to do this, the FAQ could tell how to find said function, pointing
out the most commonly used sections in the documentation. Strings, regular
expressions, arrays, date/time are the ones that come out of my mind when
wondering what do I use most often.


Vincent


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] catching a robot or spider - asking too

2002-11-19 Thread Vincent Vandemeulebrouck
 does anybody know a way to make a distinction
 between robots and users?
 should I use the user agent? Or is this not a safe method.
 If the visitor is a spider/robot I want to include some script
 containing extra URL's for the robot.

I am very interested too in this, as I received visits from a site with a
rather strange user agent (well, at least, that I did not expect) on a web
site of mine. The user agent was something like

SurveyBot/2.2 a href=\'http://www.whois.sc\'Whois Source/a

I really don't know how I should generate my pages in this case, what kind
of stylesheet I should include to make the page correct (if I even have to).

Anyway, the real question behind is :

Is there a good way to handle the user agent info?


Vincent Vandemeulebrouck
http://www.leguerriersorde.com/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] check for \n

2002-11-18 Thread Vincent Vandemeulebrouck
  $sql = 'SELECT id,ST FROM ccl.ccl_main';
  ...
  $news = mysql_query($sql);
   while ($mydata = mysql_fetch_object($news))
{
  if ???$mydata-ST?
echo $mydata-id  -  $mydata-SThr;
   }
 
 Use strstr() with \n as the needle. Check out the String functions 
 chapter, lots more goodies there.

Or, try the following:

$sql = SELECT id,ST FROM ccl.ccl_main where ST like '%s\n%s' ;

I am not 100% sure it will work with 'text' field, but it should.

Vincent Vandemeulebrouck


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php