Re: [PHP] Re: Think I found a PHP bug

2011-12-09 Thread Lester Caine

Rasmus Lerdorf wrote:

This is fixed in PHP 5.4 by completely dropping support for the TZ
environment variable. PHP will always use UTC unless you explicitly set
it to something. It won't matter which timezone the system is running
in. This is the only reliable way to always have consistent behaviour
across all environments.


Just taking that a step further ...
The second that you need to actually take a users time zone into consideration, 
then the best way of working is to RUN the sever set to UTC. And store any time 
information in UTC. Then you can display times TO USERS either as UTC, or as 
their own local time or the local time of the location an event is happening at. 
You just need to remember that timezone information provided by the browser is 
only todays time offset, so any area with daylight saving will be wrong for half 
of the year, so that is the point you need to store a user or loction timezone 
reference. Many systems still only store 'offset' which is simply wrong :)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



[PHP] Question about performance between for iteration and extension function

2011-12-09 Thread Lin Yo-An
Hi folks,

I am in doubt of this, I thought pure php iteration is slower than calling
join or other extension functions.

but the result shows:  https://gist.github.com/b2a94c94ca66a55814d4

Using Pure PHP for iteration is faster than using join function. why ?
because of the php runtime typecasting ?

And json_encode is the most slowest.

-- 
Best Regards,

Yo-An Lin


Re: [PHP] End of session clean-up

2011-12-09 Thread Andre Majorel
On 2011-12-03 18:14 +, Stuart Dallas wrote:

> Writing a session handler is pretty straightforward. I wrote
> about how to implement one to use MySQL a while back which I'm
> sure you could easily adapt to your needs.
> 
> http://stut.net/2008/07/20/mysql-sessions/

Thank you. That's too much code for the amount of time I had,
though. So I just added the purging of old records to the code
that creates them.

It's not ideal in that old records remain until someone opens a
new session. But it's quicker and safer than writing a whole
session handler.

-- 
André Majorel http://www.teaser.fr/~amajorel/

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



[PHP] offline practice

2011-12-09 Thread saeed ahmed
i have learned a bit to work php-mysql but i want to practice to know
more.at this moment i only can do primary works.creating users,inserting
data,viewing very simple reports.i want to practice any sample php_mysql
site offline.any help please.
thanks


Re: [PHP] Question about performance between for iteration and extension function

2011-12-09 Thread Matijn Woudt
On Fri, Dec 9, 2011 at 5:04 PM, Lin Yo-An  wrote:
> Hi folks,
>
> I am in doubt of this, I thought pure php iteration is slower than calling
> join or other extension functions.
>
> but the result shows:  https://gist.github.com/b2a94c94ca66a55814d4
>
> Using Pure PHP for iteration is faster than using join function. why ?
> because of the php runtime typecasting ?
>
> And json_encode is the most slowest.

There's a bug in your first test (the php iteration). You're using $i
for the inner and outer loop, meaning that the outer loop will only
run once.  Try this updated example:
https://gist.github.com/1452696

On my box it gives(with microtime instead of your timer class):
php join.php
n=1000
Pure PHP iteration: 0.87661409378052

String join: 0.13562703132629

json_encode: 0.081185102462769

json_encode is the fastest one here.

Matijn

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



[PHP] PHP, PDO and MS-SQL ?

2011-12-09 Thread Andreas

Hi,
could someone tell me what I need to install and how to configure 
everything so that I can connect with PHP and PDO to a MS-SQL server?


I have an OpenSuse 11.4 installation. I added the Apache-PHP repository 
and upgraded to PHP 5.3.8.

php-mssql, -php-odbc, libfreetds and the freetds-tools are installed.
Do I need all this or anything else?
phpinfos() reports the odbc and mssql modules are loaded.
I can't find config files, though.

The aim is to connect to a ms-sql server using PDO without a system dsn 
if possible.


Is there a detailed description for people who don't know everything 
about this stuff, yet?



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