News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Nikita Popov:
The case against the ifsetor function
January 13, 2014 @ 09:22:52

In his latest post Nikita Popov aims to make a case against the introduction of the "ifsetor" function to be introduced into the PHP language. This function takes in a variable to find and, if found returns it. If not, it doesn't produce an error (or warning).

Recently igorw wrote a blog post on how to traverse nested array structures with potentially non-existing keys without throwing notices. The current "idiomatic" way to do something like this, is to use isset() together with a ternary operator. [...] Someone on /r/PHP pointed out that there is an alternative approach to this problem, namely the use of an ifsetor function.

He goes on to talk about by-reference argument passing, why requesting an undefined array index doesn't really throw an error and how writes don't have the same issues as reads. He then gets into his own issues around the "ifsetor" function, namely:

  • Creation of dummy values
  • No notices for nested indices
  • Null values treated as non-existing
  • Default is always evaluated
  • By-reference passing often forces a copy

He summarizes most of the issues in one statement - "there is way too much by-ref magic involved". He then looks at some of the ways that this could be helped but opts instead for something more like "get_in" as proposed by Igor.

0 comments voice your opinion now!
ifsetor getin array read write problem byreference

Link: http://nikic.github.io/2014/01/10/The-case-against-the-ifsetor-function.html

Mikko Koppanen:
PHP extension writing
October 21, 2013 @ 10:35:15

Mikko Koppanen has written up a quick post sharing some work he's done to help make writing extension in PHP a little bit easier. He's created a new project that shares some of his experience in extension development.

I plan to add practical examples related to extension writing. There won't be extensive written documentation outside the code, but hopefully the code itself contains enough nuggets of information to be useful. As the README says, if you need a specific example or clarification on something just open an issue in Github.

The project is still in its early stages, but plans are to have quite a bit more examples as time goes on. Also, as Johannes Schlüter points out in the comments, there's also another example like this - Marcus Boerger's demoext (with accompanying slides).

0 comments voice your opinion now!
extension write demo example github project extsample

Link: http://valokuva.org/php-extension-writing/

Kevin Schroeder:
More - The file system is slow
September 30, 2013 @ 10:44:29

As a follow-up to his previous article about the (minimal) overhead from logging, Kevin Schroeder has this new post focusing on the common belief that writing to the file system is the slowest method.

I had a conversation the other day by a person I respect (I respect any PHP developer who knows how to use strace) about the cost of file IO. My assertion has been, and has been for a long time, that file IO is not the boogeyman that it is claimed to be. So I decided to test a cross between those two posts.

His test was to write one million log records to two different sources - the normal physical file system, a RAM drive - one run with a file handle that's left open and the other with a new handle each time. He shows how he made the RAM drive and the PHP he used for the test (running in a VM). He graphs out the results with some interesting results...but you'll have to read the post for that.

0 comments voice your opinion now!
file system slow write log overhead benchmark ramdisk graph

Link: http://www.eschrade.com/page/more-on-the-file-system-is-slow/

Derick Rethans:
Mongo is dead, long live MongoClient
November 28, 2012 @ 09:13:51

In this recent post to his site Derick Rethans mentions the shiny new "MongoClient" class that the latest release of the Mongo PHP drivers provides.

This afternoon we published version 1.3.0 of the MongoDB PHP driver. Besides a number of bug fixes since RC2 and RC3, this new release also includes a new MongoClient class. This new MongoClient class serves as a replacement for the Mongo class. The old Mongo class is now deprecated and will be removed in a future release, although we are keeping it in place for now because of backwards compatibility reasons. We have already removed it mostly from the documentation, and are working to update all our other material as well.

The main change that comes with the MongoClient class is that it now has acknowledged writes on by default (a "safe mode"). This option determines wether or not the client waits for a confirmation from the server when a write has happened. He includes a bit of code showing how to: turn it off, keep it on or using replica set acknowledged writes. You can also set it on a per-query basis.

0 comments voice your opinion now!
mongo class driver release mongoclient class confirm write


Qafoo Blog:
Webinar "Writing Testable Code"
March 21, 2012 @ 12:54:49

As Tobias Schlitt points out in this recent post to the Qafoo blog, the recording of a webinar he did (for Zend) about "Writing Testable Code" has been posted for listening online.

In this session you will gain insight into the secret of writing easily testable code and you'll learn how this relates essentially to good object orientation.

The recording is just one of many webinars Zend offers on a wide range of development topics, including:

Almost all presentations also come with PDF versions of their slides attached, too.

0 comments voice your opinion now!
webinar write testable code qafoo tobiasschlitt


Kevin Shroeder's Blog:
Zend_Log with multiple writers
September 14, 2010 @ 10:39:34

Kevin Schroeder has a recent post to his blog about a handy trick Zend Framework developers can use to have Zend_Log write out to multiple sources at once pretty easily.

If you were not aware, Zend_Log provides facilities for writing to multiple logs through the same log instance. Additionally, you can do this via configuration options when using a Zend_Application resource plugin. Together those make for very powerful logging mechanisms. "How?" you ask? It's really easy.

The trick lies in the application.ini file configuration. He includes an example of how you can set this up showing how to make two different environments log differently - development writes to log/firebug and production just writes to the log. He includes some sample code for a basic controller showing you how to use it.

0 comments voice your opinion now!
zendlog zendframework tutorial multiple write development production


Derick Rethans' Blog:
Available for PHP Extension Writing
March 16, 2010 @ 09:40:24

Derick Rethans, realizing that he wasn't ready to jump back into a full-time position just yet has decided to refocus his efforts on helping make PHP a better place with work on PECL extensions and on internals-related issues.

Instead I will be available to work on (custom) PHP extensions and internals related issues. Extensions are a great way around PHP's limitations and performance issues.

His first project is a QuickHash extension to interface with the popular StumbleUpon and works more efficiently by using more clearly defined data structures. There's no stable release yet, but keep an eye on the subversion repository for the latest enhancements.

1 comment voice your opinion now!
extension write stumbleupon pecl


Brian Jones' Blog:
If You Code, You Should Write
September 10, 2009 @ 12:38:21

According to his latest blog post Brian Jones suggests that if you're writing code, you should share your thoughts with the world with some writing.

Writers often take the exact same course as do programmers. Programmers and writers alike are often given assignments. Assignments take the form of a problem that needs solving. For a programmer it's a function or method or class that needs implementing to perform a certain task. For a writer it's an article or column or speech that covers a particular topic.

He talks about some of the concepts around writing as opposed to coding - rough draft versus final version, the process you work through and how you can use writing to help others and yourself.

0 comments voice your opinion now!
code write opinion


Maarten Balliauw's Blog:
PHPPowerPoint 0.1.0 (CTP1) released!
April 30, 2009 @ 11:16:53

Maarten Balliauw has posted about the release of a new bit of software to help you read and write from/to Microsoft PowerPoint files - PHPPowerPoint (0.1.0 CTP1).

Just like with PHPExcel, PHPPowerPoint can be used to generate PPTX files from a PHP application. This can be done by creating an in-memory presentation that consists of slides and different shapes, which can then be written to disk using a writer (of which there's currently only one for PowerPoint 2007).

Some example code is included that creates a single-slide slideshow with the PHPPowerpoint logo and the text "Thank you for using PHPPowerpoint". There's plenty of configuration options and you can place things in the slides down to the pixel. You can try out this initial release here.

3 comments voice your opinion now!
phppowerpoint release powerpoint slide microsoft read write


Blue Parabola Blog:
Writing Tech Books 101
March 03, 2009 @ 11:11:28

For anyone out there looking to write a tech-related book, you will want to check out these tips from Matthew Turland over on the Blue Parabola blog. He gives eight (or so) tips to help out the budding authors in their pursuit for published stardom.

In lieu of a topic more focused on technical subject matter or practical application, I decided to take a post and detail some of my experiences in writing a book. [...] It's been quite the long haul, but I think being able to hold a copy of it in my hands will make it all worth it. So, here is the process as I've learned it from my own perspective.

Here's the overview of his list (there's lots more detail under each one):

  • Be Serious
  • Know Your Reasons
  • Have a Concrete Idea
  • Put Pen to Paper
  • Do Your Homework
  • Shop Around
  • Find Editors
  • Nose to the Grindstone
  • Other miscellaneous items related to being an author

And, of course, the most important part - "Go Forth and Write".

0 comments voice your opinion now!
write technology book tip suggestion



Community Events





Don't see your event here?
Let us know!


introduction framework community laravel package install language deployment zendserver opinion library interview series symfony api tips release update podcast list

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework