php-general Digest 9 Dec 2011 20:09:28 -0000 Issue 7604

Topics (messages 315962 through 315967):

Re: Think I found a PHP bug
        315962 by: Lester Caine

Question about performance between for iteration and extension function
        315963 by: Lin Yo-An
        315966 by: Matijn Woudt

Re: End of session clean-up
        315964 by: Andre Majorel

offline practice
        315965 by: saeed ahmed

PHP, PDO and MS-SQL ?
        315967 by: Andreas

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 ---
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

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
On Fri, Dec 9, 2011 at 5:04 PM, Lin Yo-An <cornelius.h...@gmail.com> 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

--- End Message ---
--- Begin Message ---
On 2011-12-03 18:14 +0000, 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/

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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?


--- End Message ---

Reply via email to