News Feed
Jobs Feed
Sections




News Archive
feed this:

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

Brandon Savage:
Private Methods Considered Harmful ("Do This, Not That" Excerpt)
December 10, 2012 @ 11:26:42

A while back Brandon Savage mentioned a book he was writing ("Do This, Not That") to help PHP developers learn some of the best practices associated with the language. Today he's posted an excerpt from the book for your enjoyment.

This great series of highly focused e-books will offer tips, tricks and best practices focused on core areas of PHP development, including databases, security, filtering, regular expressions, configuration and more. Since it will be a series of tightly targeted solutions, developers will be able to pick all, some or just one of the offerings that solves their specific problem(s).

This excerpt looks at private method use in your applications and why they could be considered "evil" if not used correctly.

0 comments voice your opinion now!
book excerpt private method dothisnotthat introduction bestpractices


Kevin Schroeder's Blog:
You want to do WHAT with PHP? Chapter 8
September 24, 2010 @ 12:39:17

On his blog today Kevin Schroeder has the latest in a series of excerpts from his book "You Want to Do WHAT with PHP?" - a section of the chapter on daemons.

PHP is a language generally not suited for running daemons. That said, PHP can do it, and in certain circumstances does it sufficiently for the job. In this chapter we look at some of the things you need to know about to build a PHP-based daemon. This excerpt doesn't feature any code, but it does set the foundation for why I think PHP is fine for daemons in some circumstances.

The excerpt is mainly the first part of the chapter that just introduces the idea of daemons including some of the right and wrong uses, using the right tool for the job and how using PHP for a daemon can help with needs in a place where PHP might already be a norm.

0 comments voice your opinion now!
book excerpt kevinschroeder chapter daemon


Kevin Schroeder's Blog:
You want to do WHAT with PHP? Chapter 6 & 7
September 15, 2010 @ 08:16:53

Kevin Schroeder has posted excerpts from the sixth and seventh chapters from his "You Want To Do WHAT With PHP?" book.

Chapter 6 focuses on asynchronous processing and the excerpt talks about doing it with a little big of encryption on the side.

In the excerpt from Chapter 7 he looks at a more structured way to access files rather than just the random fopen or file_get_contents. There's a code example in this one showing how to get the header information off of a file for things like file type, last modified time, a header checksum and the file's permissions.

0 comments voice your opinion now!
book excerpt asynchronous processing file access


Kevin Schroeder's Blog:
You want to do WHAT with PHP? Chapter 5
September 03, 2010 @ 11:14:58

Kevin Schroeder has the latest excerpt from his book posted ("You Want to Do WHAT with PHP?") with a focus on the SPL - Standard PHP Library. He specifically takes a quick look at Iterators.

If you are doing any data processing whatsoever you are using arrays. And most likely you are doing database queries, iterating over the results and doing your algorithm-ing. But what if you have additional functionality that you need to have integrated with your data. You could go the traditional route and copy and paste half your application around or you could build, what we like to call structured applications. SPL allows you to do that.

In the excerpt he mentions the methods that come built in to Iterators like rewind, current and valid. There's also some sample code showing a custom iterator that works with some user data to output the information set in the constructor. You can find out more about this chapter and the rest in Kevin's book.

3 comments voice your opinion now!
book excerpt kevinschroeder iterator spl standard library


Kevin Schroeder's Blog:
You want to do WHAT with PHP? Chapter 4
September 02, 2010 @ 13:49:23

Kevin Schroeder has another new post to his blog today with an excerpt from his "You Want to Do WHAT with PHP?" book. This new post is a section from the fourth chapter looking at stream handling.

Communication is key to building applications now and for the future. While it is not something that I think that everyone should do, I have not seem many applications that make good use of streams in PHP. Streams can be immensely useful in the right situations, but a lot of developers are not really aware of how streams can be used. [...] While I don't think you will end up basing your application around streams it is a really good idea to know how streams work.

The sample code (and description) talk about changing the properties of a stream on the fly. He shows how, with a fgets loop checking the input, he can catch a command from the already running script and change the compression setting on the currently open stream. The compression changes the stream's data from plain text to a binary format as handled by the streams functionality.

1 comment voice your opinion now!
book excerpt kevinschroeder streams


Kevin Schroeder's Blog:
You want to do WHAT with PHP? Chapter 3
August 31, 2010 @ 13:44:32

Kevin Schroeder has posted another excerpt from his "You Want to Do WHAT with PHP?" book to his blog today. This time it's from the third chapter that looks at character encodings like UTF-8 or ISO-8859-1.

I realized that while this 3.5-year PHP consultant knew Unicode, UTF-8, character encodings such as ISO-8859-1 or ISO-8859-7, I didn't understand them as well as I thought I had. With that I threw this chapter in the book. Knowing about character encoding is what many developers have. Not as many truly understand it. In this chapter I try to de-mystify character encoding as a whole.

The excerpt introduces character encoding and what it really is - a translation for the computer to be able to handle the human language. The problem comes in when multiple tools try to define the same sort of letters/chatacters in different ways. He gives an example of a "hello world" string in a normal ASCII format versus one from the EBCDIC format and how it would be rendered by an ASCII-understanding browser.

0 comments voice your opinion now!
character encoding book excerpt ascii example


Kevin Schroeder's Blog:
You want to do WHAT with PHP? Chapter 2
August 27, 2010 @ 08:09:07

Kevin Schroeder has posted a new book excerpt from his "You Want to Do WHAT with PHP?" book - chapter two dealing with binary protocols.

PHP developers know text really, really well. We can write SQL, we can build HTML, we can work with XML. But computers don't speak in terms of structured text markup, they speak in terms of bytes. And while there are many PHP developers who can speak at the lower level of bytes and bits and such, there are many more that have difficulty there.

His short excerpt (from a very long chapter) talks about working with DNS information and how you can send requests (similar to the unix "host" command) and parse them correctly. Some sample code is provided to make a request for a record on mcpressonline.com and the output it would produce.

0 comments voice your opinion now!
book excerpt kevinschreoder binary dns request


Kevin Schroeder's Blog:
You want to do WHAT with PHP? Chapter 1
August 26, 2010 @ 11:03:27

Kevin Schroeder has a new post today with an excerpt from his book "You Want to do WHAT with PHP?" - the first chapter looking at networking and socket connections.

I'm also woefully behind on blogging. So, to alleviate that I am going to post an excerpt from my upcoming book "You want to do WHAT with PHP?" Today we are going to take a look at Chapter 1.

The sample chapter talks about figuring out the host to netmask relationship relationship by parsing the IP with the ip2long and comparing that to the list of netmasks from an array. Sample code is provided as well as output for reference.

0 comments voice your opinion now!
book excerpt networking sockets netmask ip


NETTUTS.com:
How to Create Blog Excerpts with PHP
July 23, 2010 @ 09:11:18

On NETTUTS.com today there's a tutorial (a screencast) that'll show you how to create excerpts for the posts in your blog. Their method could be applied to just about any PHP-based blog software out there since it uses base PHP functions and MySQL features.

Ever visited a blog, and noticed that each posting's overview only contained a hundred characters or so, which is then followed by '''? Ever wondered how to do that yourself? It's not quite as easy as you might think. What if character number 100 occurs in the middle of a word? Do you want to display half of a word on the page? Of course not. In this video tutorial, I'll show you how to compensate for this, as well as a host of other neat little things, like working with MySQL's LEFT() function, using PHP's strrpos, and substr, creating the beginning's of an actual blog, and more.

They show you how to use the MySQL LEFT() function, strrpos and substr to make creating these summary blocks of text simple.

0 comments voice your opinion now!
blog excerpt tutorial screencast mysql strrpos substr


SitePoint.com:
How To Handle File Uploads With PHP
July 10, 2009 @ 10:25:50

New on the SitePoint "PHP & MySQL Tutorials" blog today Kevin Yank has posted another excerpt from the "Build Your Own Database Driven Website Using PHP and MySQL" looking at handling file uploads in PHP.

An common challenge faced by PHP programmers is how to accept files uploaded by visitors to your site. In this bonus excerpt from Chapter 12 of [the book] you'll learn how to accept file uploads from your web site visitors securely and store them.

The tutorial introduces the $_FILES superglobal and how you can use it to access the file information about the uploads the user's can make. He also mentions some of the functions that can be used on the files (like is_uploaded_file).

1 comment voice your opinion now!
book excerpt tutorial upload file



Community Events











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


podcast install code package example unittest opinion framework component facebook overview language security introduction symfony2 release hhvm hack application composer

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