php-general Digest 12 Jun 2010 21:31:42 -0000 Issue 6795

Topics (messages 306072 through 306075):

Re: Why is there HTML in the error_log output? Please make it stop.
        306072 by: Peter Lind

Re: is <?= good?
        306073 by: tedd

How to change the first line of a text file
        306074 by: Richard Kurth

how to run pecl install pam
        306075 by: fakessh

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On 12 June 2010 11:23, Peter Lind <peter.e.l...@gmail.com> wrote:
> On 12 June 2010 01:17, Daevid Vincent <dae...@daevid.com> wrote:
>> I'm trying to clean up some code and have been looking at error_log output
>> and they all look like this:
>>
>> [11-Jun-2010 23:04:54] <font color='red'><b>In
>> /var/www/my_notifications.php, line 40:  WARNING</b>
>> Invalid argument supplied for foreach()
>> </font>
>>
>> I can't figure out:
>>
>>        [a] why the logs are in HTML format to begin with? Seems useless.
>>        [b] how do I turn it off and just be plain text (i.e. striptags()
>> )?
>>        [c] where is this <font color='red'> coming from?
>>
>> I've looked in /etc/php5/apache2/ and grepped through, but don't see 'red'
>> anywhere.
>>
>> I do see this, but it has no effect, as you can see by me 'disabling' it.
>>
>>  388 ; String to output before an error message.
>>  389 ;error_prepend_string = "<font color=ff0000>"
>>  390 error_prepend_string = ""
>>  391
>>  392 ; String to output after an error message.
>>  393 ;error_append_string = "</font>"
>>  394 error_append_string = ""
>>
>
> Did you check the html_errors directive?

Other thing that comes to mind is xdebug which will format error
output - not sure if that ends up in the error log though.

Regards
Peter


-- 
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
</hype>

--- End Message ---
--- Begin Message ---
At 5:28 PM -0700 6/11/10, Daevid Vincent wrote:
 > -----Original Message-----
 > From: Ahmed Mohsen [mailto:mre...@gmail.com]
 >
 Hey Daevid, does this form <?php echo 'The answer is '.$answer; ?>
 improve anything in processing time or it's just for the sake of
 readability?

Technically it does have a microscopic speed increase, but unless you're
pumping out hundreds or thousands of lines (like in a loop) you most likely
won't notice it. In my code, I always try to use the proper quote marks
because I *am* dealing with huge tables of data. I've said this a hundred
times before, if you can shave off 0.001 from each row, then after 1,000
rows, you've shaved 1 second off the page time. That seems small, but that
shit adds up. Caching will help, as the page is already parsed once, so PHP
doesn't have to do the work again in many cases. To me, it's a good habbit
and costs you nothing to do.

The difference is that with " the PHP engine has to pre-process the string
and look to see if there's anything interesting it needs to do -- such as
replace any $var with their equivalents or \n or whatever else. A ' means
to use it as is, so PHP just spits it back out.

In my test comparing:

   $a = 'The answer is ' .$answer;

vs:

   $a = "The answer is $answer;"

I ran numerous test using 10,000,000 (10 million) operations each and the results never exceed 1/2 of a second difference, usually around 1/3 of a second.

I realize that servers and conditions can change the results, but these results are what my server produced. I also realize there can be special conditions where one should consider speed, but seldom is the case where one needs to be concerned about pre-processing a string. The likelihood that it will present a problem is extremely remote. And these results are with today's speeds -- the difference will be less tomorrow and an order of magnitude less in a couple of years, or less.

I guess that what I am trying to say is pick considerations that are significant enough to have real merit. If you can show that your solution can be significantly improved by doing something a certain way, then more power to you. However, simply saying one way is better because it is faster, or uses less memory, doesn't carry the weight it once did. For example, it would have been nice if the net had been based on 8-bit instead of 7-bit, but the people who developed ASCII were concerned about memory. They were right for what they considered important at their time, but those concerns created a larger problem for the industry that followed. The significants of concerns change over time and not realizing that can create problems later.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---

I have around 6000 text files and I need to change the first line on every one of them.

The first line is the title of the article and I need it look like this <title>the name of the article</title>

every file has the first line and the it starts the article on the second line

The files are in many directory under one main directory
like this

top directory
           fashion-school
           Dogs
           DentalAssistant
           etc..........

I need a script that will loop through each directory look at each file extract the first line and replace it with the example above. I have figured out how to pull the first line into an array but I don't no where to go from there to look in each directory and the write the data back at the top.

$f = file('GENERAL HISTORY OF DOGS.txt');
$a = '<title>' . $f[0] . '</title>';
echo $a;



--- End Message ---
--- Begin Message ---
hi list php
hi network php
hi all the guru of php


how to run pecl pam
I own a system centos 5.5 with deposits remi for php
what are the specific changes to /etc/pam.d/ and php.ini


and can you give me an example that works with all the details

--- End Message ---

Reply via email to