• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Matt Doyle | Elated Communications

Web and WordPress Development

  • About Me
  • Blog
    • Design & Multimedia
      • Photoshop
      • Paint Shop Pro
      • Video & Audio
    • Online Marketing
      • E-Commerce
      • Social Media
    • Running a Website
      • WordPress
      • Apache
      • UNIX and Linux
      • Using FTP
    • Web Development
      • HTML
      • CSS
      • JavaScript
      • PHP
      • Perl and CGI Scripting
  • Portfolio
  • Contact Me
  • Hire Me
Home / Blog / Web Development / PHP / PHP Functions

PHP Functions

Learn all about PHP functions: How to create your own functions, how variable scope works, the concepts of references and recursion, and more!

PHP Anonymous Functions: What Are They, and Why Use Them?

10 December 2012 / 8 Comments

PHP Anonymous Functions: What Are They, and Why Use Them?

In this tutorial you’ll explore anonymous functions in PHP. Anonymous functions are a PHP feature that you probably won’t use that often; however, they can be really useful in certain situations, as you’ll see.

You’ll look at the following concepts in this tutorial:

  • What anonymous functions are, and how you create them
  • How to assign anonymous functions to variables
  • How to call anonymous functions
  • Using anonymous functions to create neater callbacks, and
  • Creating closures with anonymous functions.

Ready to dive into anonymous functions in PHP? Let’s go!

[Read more…] about PHP Anonymous Functions: What Are They, and Why Use Them?

PHP Recursive Functions: How to Write Them, and Why They’re Useful

4 February 2011 / 9 Comments

PHP Recursive Functions: How to Write Them, and Why They're Useful

Like most programming languages that support functions, PHP lets you write recursive functions. In this tutorial, we’ll explore the concept of recursion in PHP, and discover how to create recursive functions for various tasks.

Recursion is one of those topics that can seem confusing at first, but once you start writing recursive functions you’ll see how elegant recursion can be!

[Read more…] about PHP Recursive Functions: How to Write Them, and Why They’re Useful

PHP Variable Scope: All You Need to Know

15 October 2010 / 6 Comments

PHP Variable Scope: All You Need to Know

When you’re just starting to work with functions and objects in PHP, variable scope can be the cause of some confusion. Fortunately, PHP’s scope rules are relatively easy to understand (compared to some other languages, at least!).

In this tutorial you’ll learn all you need to know about variable scope in PHP. You’ll look at:

  • The concept of variable scope — what it is, and what it means
  • The differences between global and local scope
  • How to access global variables from within a function
  • PHP’s superglobals, and how they work
  • How to use static variables to preserve state

Let’s get started!

[Read more…] about PHP Variable Scope: All You Need to Know

Make Your Own PHP Functions: The Newbie Guide

16 September 2010 / 4 Comments

Make Your Own PHP Functions: The Newbie Guide

You’re no doubt familiar with using functions in PHP. The language contains hundreds of built-in functions that you can use for all sorts of handy jobs — from manipulating text through to reading files, sending email messages and processing images.

You’re not limited to using just the predefined functions, though — you can create your own functions too! In this tutorial, I’ll show you how. You’ll learn:

  • Why it’s good to create your own functions
  • How to create and use a function
  • How to make your functions flexible by using parameters
  • All about optional parameters and default values, and
  • How to return values from your functions.

Ready? Let’s get started!

[Read more…] about Make Your Own PHP Functions: The Newbie Guide

Primary Sidebar

Hire Matt!

Matt Doyle headshot

Need a little help with your website? I have over 20 years of web development experience under my belt. Let’s chat!

Matt Doyle - Codeable Expert Certificate

Hire Me Today

Call Me: +61 2 8006 0622

Stay in Touch!

Subscribe to get a quick email whenever I add new articles, free goodies, or special offers. I won’t spam you.

Subscribe

Recent Posts

  • Make a Rotatable 3D Product Boxshot with Three.js
  • Speed Up Your WordPress Website: 11 Simple Steps to a Faster Site
  • Reboot!
  • Wordfence Tutorial: How to Keep Your WordPress Site Safe from Hackers
  • How to Make Awesome-Looking Images for Your Website

Footer

Contact Matt

  • Email Me
  • Call Me: +61 2 8006 0622

Follow Matt

  • E-mail
  • Facebook
  • GitHub
  • LinkedIn
  • Twitter

Copyright © 1996-2023 Elated Communications. All rights reserved.
Affiliate Disclaimer | Privacy Policy | Terms of Use | Service T&C | Credits