Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!

Archive for Lipiec, 2012

PHPMaster.com: Baking Cookies in PHP

PHPMaster.com: Baking Cookies in PHP

On PHPMaster.com there’s a new tutorial about working with cookies in PHP applications – an introductory look at what they are, how to set them and how to read their values.

Have you ever wondered that in spite of HTTP being a stateless protocol, when you log in to a website and buy stuff and checkout how the server can identify you uniquely? You might wonder if HTTP is stateless but your state is maintained through your interactions, isn’t this a contradiction? Welcome to world of cookies (not the ones which we can eat, btw :) ), one the of primary ways to maintain user state and interaction between the web browser and the web server.

She shares a lifecycle of a common cookie and describes the parts of the setcookie method (parameters). There’s also a few code examples showing how to read and write to them as well as update their values/expirations.

Source: http://www.phpdeveloper.org/news/18274

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Site News: Blast from the Past – One Year Ago in PHP

Site News: Blast from the Past – One Year Ago in PHPHere’s what was popular in the PHP community one year ago today:

Source: http://www.phpdeveloper.org/news/18273

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Site News: Blast from the Past – One Year Ago in PHP

Site News: Blast from the Past – One Year Ago in PHPHere’s what was popular in the PHP community one year ago today:

Source: http://www.phpdeveloper.org/news/18273

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

We Love PHP Blog: Using V8 Javascript engine as a PHP extension

We Love PHP Blog: Using V8 Javascript engine as a PHP extension

From the “Web Love PHP” blog there’s a new post showing how to use the V8 Javascript engine as a PHP extension in your application.

Just got to something described as: This extension embeds the V8 Javascript Engine into PHP. It is called v8js and the documentation is already available on php.net, examples and the sources are here. V8 is known to work well in browsers and webservers like node.js, but does it work inside PHP? YES!

They show how to get it installed (on Ubuntu) via a PECL install and a test script with some Javascript in a string variable that’s parsed by the “executeString” function on a V8 object. There’s also an example of how you can mix the functionality between the two – a simple script that uses a PHP PDO object fron inside the Javascript to perform a SQL query and set some information into the session.

Source: http://www.phpdeveloper.org/news/18272

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

We Love PHP Blog: Using V8 Javascript engine as a PHP extension

We Love PHP Blog: Using V8 Javascript engine as a PHP extension

From the “Web Love PHP” blog there’s a new post showing how to use the V8 Javascript engine as a PHP extension in your application.

Just got to something described as: This extension embeds the V8 Javascript Engine into PHP. It is called v8js and the documentation is already available on php.net, examples and the sources are here. V8 is known to work well in browsers and webservers like node.js, but does it work inside PHP? YES!

They show how to get it installed (on Ubuntu) via a PECL install and a test script with some Javascript in a string variable that’s parsed by the “executeString” function on a V8 object. There’s also an example of how you can mix the functionality between the two – a simple script that uses a PHP PDO object fron inside the Javascript to perform a SQL query and set some information into the session.

Source: http://www.phpdeveloper.org/news/18272

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

BinaryTides.com: Javascript style object literals in PHP

BinaryTides.com: Javascript style object literals in PHP

On the BinaryTides.com site there’s a recent post for those familiar with Javascript and wanting to have the same kind of object-style literals in PHP.

As similar thing [to Javascript object literals] can be done in PHP using anonymous functions (since 5.3) [...] Since version 5.3 Php added support for closures and that feature has been used above to create javascript style object literals. The use(&$a) expression makes the variable $a available inside the function happy.

Code snippets are included showing how to create these objects via the use of closures and a little trickery with call_user_func_array and __call to make assigning properties easier.

Source: http://www.phpdeveloper.org/news/18270

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

BinaryTides.com: Javascript style object literals in PHP

BinaryTides.com: Javascript style object literals in PHP

On the BinaryTides.com site there’s a recent post for those familiar with Javascript and wanting to have the same kind of object-style literals in PHP.

As similar thing [to Javascript object literals] can be done in PHP using anonymous functions (since 5.3) [...] Since version 5.3 Php added support for closures and that feature has been used above to create javascript style object literals. The use(&$a) expression makes the variable $a available inside the function happy.

Code snippets are included showing how to create these objects via the use of closures and a little trickery with call_user_func_array and __call to make assigning properties easier.

Source: http://www.phpdeveloper.org/news/18270

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Community News: PHP Benchmarks Compared to Several Languages

Community News: PHP Benchmarks Compared to Several Languages

Ariz Jacinto has pointed out some results from a recent benchmarking “game” that compares the performance of several languages against each other in overall speed.

Here’s the link to the Computer Language Benchmark Game as of July
15, 2012. You’ll see that the median speed of PHP is slightly faster
than Python 3 and Ruby 1.9 on x64 Ubuntu/IntelQ6600 Quad-core machine.

You can visit the results page and turn on and off various languages to get the updated results in the chart. You can also limit it down to one of the many benchmarking test types as well.

Source: http://www.phpdeveloper.org/news/18271

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Community News: PHP Benchmarks Compared to Several Languages

Community News: PHP Benchmarks Compared to Several Languages

Ariz Jacinto has pointed out some results from a recent benchmarking “game” that compares the performance of several languages against each other in overall speed.

Here’s the link to the Computer Language Benchmark Game as of July
15, 2012. You’ll see that the median speed of PHP is slightly faster
than Python 3 and Ruby 1.9 on x64 Ubuntu/IntelQ6600 Quad-core machine.

You can visit the results page and turn on and off various languages to get the updated results in the chart. You can also limit it down to one of the many benchmarking test types as well.

Source: http://www.phpdeveloper.org/news/18271

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Stefan Koopmanschap: Data migration with Doctrine2

Stefan Koopmanschap: Data migration with Doctrine2

In this latest post to his site Stefan Koopmanschap shares a solution he’s found to migrating data with Doctrine2 from an existing structure.

A project that I’m working on right now required me to migrate data from the existing database to the new database and database structure. Since the application is built on top of Symfony2, I decided to write a Command that would take care of the migration. I ran into an issue though: Doctrine2 insisted on creating new IDs where I wanted to keep the old one. The solution turned out to be really simple.

The actual code for the Command is only a few lines long – it just turns off the “AUTO” strategy for each of your entities, making it ignore any IDs you have set on the entity already.

Source: http://www.phpdeveloper.org/news/18269

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>