 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
PHPMaster.com: String Handling Functions
by Chris Cornutt December 26, 2011 @ 15:38:56
On PHPMaster.com today James Appleyard has put tother a tutorial for the beginners out there about working with strings in PHP, using the huge list of built-in functions to work with your values.
PHP has a vast selection of built-in string handling functions that allow you to easily manipulate strings in almost any possible way. [...] There is no way I can cover every string function in one article, and besides, that is what the PHP manual is for! But what I will do is show how to work with some of the most commonly used string handling functions that you should know. After this, you'll be working with strings as well as any concert violinist!
He shows how to use functions to: change the case of string, remove extra whitespace, get the length, slicing them up and doing replacing on some certain characters. You can find more information on these and the complete list of string functions in PHP in the manual.
voice your opinion now!
string handling function tutorial beginner
Zend PHP Certification Blog: PHP Sorting Functions
by Chris Cornutt December 21, 2011 @ 11:39:06
On the "Zend PHP Certification" blog (study notes), there's sort and natsort).
In all the countless hours I've spent with php, I've maybe used three or four of these sorting functions. I really had no idea that there is a total of eleven functions used for sorting arrays. Anyway, I'm betting that it may be useful to have these memorized before I take the Zend PHP Certification Exam so here is a brief overview of each one.
He talks about the various flags that can be used in the sorting (for regular, numeric, string and locale-based string handling) and the parameters to call for normal sorting, "natural" sorting, reverse key sorting and others. You can find specifics on these array sorting methods in the PHP manual.
voice your opinion now!
sorting function array natural reverse key user
PHPMaster.com: Defining and Using Functions in PHP
by Chris Cornutt December 01, 2011 @ 08:38:21
PHPMaster.com has a new article for those new to the PHP language posted this morning - an introduction to using functions and making your code more reusable.
Let's start by defining the word "function." A function is a self-contained piece of code which carries out a particular task (or function!). A key benefit of using functions is that they are reusable; if you have a task that needs to be performed a number of times, a function is an ideal solution. They can be either defined by you or by PHP (PHP has a rich collection of built-in functions). This article will focus on programmer-defined functions but will touch briefly on PHP's functions to complete the picture.
They include a few code snippets showing the syntax of functions (including their name, arguments and returning a value). They suggest grouping your functions together in your code for easier maintenance and share a handy tip on making a function accept a varying number of arguments.
voice your opinion now!
introduction language tutorial function syntax
DevShed: File Security and Resources with PHP
by Chris Cornutt November 23, 2011 @ 16:23:27
In the fourth part of their series looking at working with the filesystem in PHP, DevShed has posted a new tutorial focusing on security and permission handling for files/resources.
These days, security is paramount to any server installation, large or small. Most modern operating systems have embraced the concept of the separation of file rights via a user/group ownership paradigm, which, when properly configured, offers a wonderfully convenient and powerful means for securing data. In this section, you'll learn how to use PHP's built-in functionality to review and manage these permissions.
They introduce functions like:
Sample code is also included to show how to open and close a file.
voice your opinion now!
file security resource permissions function tutorial
PHPMaster.com: Array Handling Functions
by Chris Cornutt October 11, 2011 @ 08:37:55
On PHPMaster.com today there's a new tutorial introducing you to the array handling features in PHP - sorting, slicing and more.
In my previous article on PHP arrays I suggested a number of things that are tables and therefore can also be expressed as arrays. In this article I'll use a pack of playing cards to explore some of the built-in array functions most often needed by PHP programmers.
To highlight some of the array-handling functions PHP offers, I'll be using some components of Buraco - a game very popular in my part of the world and quite similar to Rummy.
In the example he represents a deck of cards with an array of values like "A", "03" and "13". This array is then looped to make the full set of 52 cards and shuffled to deal a "hand". Array functions put to use include array_rand, in_array and sort.
voice your opinion now!
array handling function tutorial example buraco card game
Gonzalo Ayuso's Blog: Building a small microframework with PHP
by Chris Cornutt August 23, 2011 @ 09:48:27
In investigating microframeworks and some of the offerings out there Gonzalo Ayuso has done a little exploring of his own. He's worked up a basic microframework and shared it in a new post as a sort of academic exercise.
Nowadays microframewors are very popular. Since Blake Mizerany created Sinatra (Ruby), we have a lot of Sinatra clones in PHP world. Probably the most famous (and a really good one) is Silex. But we also have several ones, such as Limonade, GluePHP and Slim. Those frameworks are similar.
He looks at how several of these frameworks handle routing and setup, mostly using the closures/anonymous function callbacks available in PHP 5.3. His simple example framework does some basic URI handling to find the requested module, class and function (action) to call. You can even define the output format from options like json, txt, css, js and jsonp. A sample "controller" is included with a "Hello world" and there's a mention of some other options he's exploring including Twig and Assetic integration.
voice your opinion now!
microframework exercise routing callback anonymous function
PHPCodeBase.com: PHP Magic Function glob()
by Chris Cornutt April 01, 2011 @ 08:21:20
On PHPCodeBase.com there's a recent post looking at a handy file system function that you can use to search directories simpler than a usual opendir/readdir method - glob.
Are you guys still using opendir() function to read the the files from the folder in PHP? Luckily PHP have the glob() function which perform this task very faster and smarter.
He compares an example of the opendir/readdir method to a few line replacement with glob, both searching the same directory for files. He looks at the arguments you can pass into glob - the path to search and a flag that adds special handling to the method (like turning off sorting, modifying the regular expression handling and stopping on errors).
voice your opinion now!
function glob opendir readdir regularexpression search
SearchCo.de: List of Most Commonly Used PHP Functions
by Chris Cornutt March 16, 2011 @ 13:26:27
In a new post to the SearchCo.de blog Ben Boyter generated a listing of the most commonly used PHP functions/structures based on the contents of several of the major PHP projects from around the web.
One thing that I considered some time ago was working out which are the most common functions in a language and adding this as an additional signal to ranking. I couldn't find anywhere else on the web with this question answered so I took my own approch. The method was to take a collection of large PHP projects, including, Wordpress, Mambo, Sphider, Smarty, Drupal, CodeIgniter, dump all their source code into a single file stripped of comments, and then run some simple regex over this file counting the occurance of each function.
His results show the top five as: array, isset, define, empty and assert. The last five ended up being: filemtime, sha1, array_unshift, get_current_user and strchr.
voice your opinion now!
common used function opensource project generate list
|
Community Events
Don't see your event here? Let us know!
|