 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Community News: Latest Release of Rediska
by Chris Cornutt November 26, 2009 @ 18:38:05
A new version of the Rediska library has been released today, version 0.2.1. Rediska is a PHP client for Redia, a key/value database system (written in C) that's similar to memcache.
It can be used like memcached, in front of a traditional database, or on its own thanks to the fact that the in-memory datasets are not volatile but instead persisted on disk. One of the cool features is that you can store not only strings, but lists and sets supporting atomic operations to push/pop elements.
The library includes multiple server support, content hashing, keys as objects and full Zend Framework integration. You can find out more about the project on its site or just download the latest version.
voice your opinion now!
rediska client key value
Davey Shafik's Blog: Return Values
by Chris Cornutt February 04, 2009 @ 11:14:28
Davey Shafik has taken a look at return values and keeping them standard when handing them back from the results of a database query.
In #phpc we recently had a discussion about function return values; specifically from database queries. I'm going to go on a (admittedly, rather sturdy looking) limb and say this applies to pretty much any function that returns from a data resource, not just a database .
His personal preference is to return the results data if there's matching information but to return a false value if there is an error/not results were found. He includes a snippet of example code to show the structure he's talking about. Some of the comments on the post mention things like exception handling, other similar methods other developers use and the use of nulls.
voice your opinion now!
return value array false null exception comment
Brian Moon's Blog: Null vs. isset()
by Chris Cornutt January 29, 2009 @ 09:34:59
In this new post to his blog, Brian Moon compares two things that, on the outside, might seem a lot alike but do have their differences under the hood - a null value and the isset function.
I am working with a newcomer to PHP and he asked me about setting a variable to null and how to check that. He had found some example or information that showed that setting a varaible equal to null would unset the variable. So, he was unclear if he could then reliably check if the variable was equal to null. Having avoided null like the plague in my years of PHP, I was not sure. So, I mocked up a quick script to see what the states of a variable are in relation to null.
His test verified that a variable, set equal to null will be found to be equal to null, will be set (isset) and will be found empty by PHP's empty
voice your opinion now!
null value variable compare isset empty
Sameer's Blog: Validating POST fields the easy way
by Chris Cornutt December 15, 2008 @ 16:44:17
Sameer has posted his "easy way" to validate user input coming in over a POST request:
Validating POST data from a form is a common requirement for a developer. If the number of form fields are few than the validation is a small matter. But the case is different when the form contains more than 15 or 20 fields and some of the fields are mandatory. The following code will give you an idea of how to easily validate mandatory fields, whatever the number of fields.
His method prefixes the form fields with a certain string (in his case "c_") and uses that to loop through and act as a hook to check only the form values that were submitted (and nothing else that happens to be in the $_POST array). Any number of checks could be added on to this simple example including type checks, length and validating off of another field - like a password confirm match.
voice your opinion now!
validate form value easy tutorial
Knut Urdalen's Blog: The return value of include
by Chris Cornutt November 28, 2008 @ 10:33:57
In a new entry Knut Urdalen looks at something that some PHP developers might have forgotten about - the return value of the include statement.
PHP never stops surprising me. I just found out that you're able to return values from the inclusion statements (require, require_once, include and include_once) through an example of Zend_Config.
His example puts an array of values inside the include file with a return statement. This script is included from another and, because of the return, the array data is passed back out into a waiting variable set equal to the include statement.
voice your opinion now!
include return value array zendconfig example
PHP in Action Blog: I want enums in PHP
by Chris Cornutt May 12, 2008 @ 08:41:16
I want Enums in PHP
That's how this new post on the PHP in Action blog starts this morning. The one thing that he wants is enumeration support in PHP. He shows how it can currently come close with a "roles" system:
Useful examples I've encountered in web programming are states or stages in a process and user roles. Another kind of example is one I used in PHP In Action: an authorization system with three fixed roles or categories of user: regular, webmaster and administrator.
He sets up an example class that sets constants for the different access levels rather than just relying on strings to handle it (which, as he points out, could very easily be misspelled and not throw any kind of error) .
voice your opinion now!
enumeraction enum phpinaction multiple value constant
|
Community Events
Don't see your event here? Let us know!
|