What is PHP?

Thanks For Sharing! :-)Share on Google+Tweet about this on TwitterShare on RedditShare on FacebookShare on StumbleUponPin on PinterestShare on LinkedInShare on TumblrBuffer this page

What is PHP

Now that we’ve just finished a great collection of Tutorials about WordPress, it’s time to dig into PHP. Why dig into PHP? Well we talked a little bit about all of the open source software packages that make WordPress possible, but what we didn’t mention is that the majority and bulk of the program is written in PHP. With WordPress powering almost a full twenty percent of websites worldwide, and PHP being the language WordPress is written in, we really ought to have a good understanding of PHP and how it works! PHP stands for PHP Hypertext Preprocessor. It actually originally stood for Personal Home Page Tools, which does seem to be a little easier to digest than the current PHP Hypertext Preprocessor, but I think we’ll be ok! So without further ado, it’s time for Random Bits of Awesomeness in PHP!

Server Side Scripting Language

PHP is a server side scripting language. What does this mean? Well, we had a good look at how JavaScript works in a prior tutorial, and we know that JavaScript runs in a Web Browser in most cases. PHP lives on a server, and it’s code executes on that server. Only the result of PHP output makes it to your browser, unlike how actual JavaScript can be delivered over a network to your Browser so it can execute.

What is a Script vs a Program

A computer program and a computer script are similar, yet there are very important differences. Let’s take a look at a few of the differences between the two.


A script typically triggers in response to an event. In the case of PHP, the event is the action of a user requesting to view a webpage with their web browser. This is what sends an HTTP request to the server, and triggers the execution. Once the script starts to run, it does so from top to bottom in a very linear fashion. This happens quickly and with no user interaction. Once this process is complete, the script shuts down so to speak until another request is made.


Programs are much different. You are probably more familiar with computer programs than you are with scripts. A program is launched, and then it continues to run without the need for additional requests being made. It also may jump around within the code as the software runs depending on user interaction, unlike the top to bottom nature of a script. For example, you likely are familiar with Microsoft Word or Microsoft Excel. These are computer programs that when launched, continue to run and wait for user input, then take action on the input provided.

Blurred Lines

Much like Robin Thicke, the distinction between a script and a program can begin to have blurred lines. That is to say, as scripts become more complex, especially when you’re talking about high level frameworks and development environments, they begin to closely resemble the nature of a true computer program. So what’s the big deal you say? Well, it’s not a big deal really. It just helps to remember PHP’s humble beginnings as compared to where it stands today in all of its modern object oriented design glory.

What does Server Side mean?

When we say server side, we mean the actual code is installed on a remote server. The only environment under which that code can execute is on that very server. It’s in many ways much safer than JavaScript. <flamesuit> JavaScript has it’s place, and contrary to the Node.js fans among the populous, it is not on the server! </flamesuit>. PHP is designed to work with HTML. You can embed PHP inside of HTML, or use PHP to generate HTML to be sent across the network to a users web browser. Files use a .php extension to tell the server that there is PHP code contained within the file that must be interpreted and executed. The syntax is a derivative of the C Family of languages. In fact the PHP engine itself is written in C, which is for all intents and purposes, the de facto language of all of computer science. PHP is very flexible and can be arranged in a super disciplined and clean style as is the case with modern frame works, or it can be intertwined like Spaghetti into your HTML to create various effects. The only limit is your imagination, so get your favorite imagination stimulant ready.

The Glorious History of PHP

If you’ve ever listened to any of the great Douglas Crockford’s lectures on JavaScript, you’ll know that Doug likes to talk about the entire spectrum of computers and computer science all the way back to Grace Murray Hopper who was born on December 9, 1906. Grace is credited with being a true pioneer in computer science. It is always fascinating to listen to experts in the field discuss history and travel through time so to speak to arrive at where we are today. In the case of PHP, it’s life began in 1994 at the hands of a genius named Rasmus Lerdorf. Rasmus used the C Programming language to create the the very first iteration of PHP, and C is still what powers the PHP engine today. Early on, PHP was quite limited but by 1998 Andi Gutmans and Zeev Suraski joined the project and rewrote the PHP engine for version 3 of the language. It was also at this time that the naming convention of PHP changed from that of Personal Home Page tools to PHP: Hypertext Preprocessor. Some say this was the point at which we should have begun to fear PHP, when these guys decided to make use of a recursive acronym to describe their creation. Fear not! PHP is awesome, no matter what we call it. Fast forward to the Y2K, and PHP had another major overhaul. This is when Andi Gutmans and Zeev Suraski formed Zend, the PHP Company. They rewrote the engine again, and began to incorporate more modern techniques, and the beginnings of OOP or Object Oriented Programming techniques into the language. PHP 5 came out in the year 2004, and it is from this version that the modern iterations of PHP that we will discuss here are derived. PHP is now a modern and powerful scripting language, and we’ll learn all about it as we tackle the ins and outs of how to use it.

The Use Case for PHP

As you began your adventure as a web developer, you learned HTML, and while it was great to learn how to create files and place them on a server for others to view with a web browser, you began to see the limits of this approach. HTML is static, you can’t embed logic or behavior into HTML. Along comes PHP to the rescue.

  • PHP is Open Source PHP is open source software which means you are free to download it, use it, modify it, or otherwise do whatever you want with it. There are no license fees or restrictions to worry about, and did we mention, it is free.
  • PHP is cross platform PHP will run on Windows, Linux, OSX, or any other flavor of UNIX you can think of. You are not restricted to a proprietary platform with restrictive lock in.
  • PHP is Powerful and Scalable PHP is simple enough to build a super basic website for your small company website or blog. It will also scale to power multi billion dollar companies like Yahoo and Facebook, both of which rely on PHP to support their infrastructure. Many of the very most visited high traffic websites in the entire world run on PHP.
  • Made for the Web PHP was built for the web. The internet and world wide web rely on many different protocols and aspects of the IP stack to run. PHP has support built right in for dealing with HTTP hyper text transfer protocol, FTP file transfer protocol, DNS domain name system, Streams, Sockets, and more. PHP was built for the internet.
  • Object Oriented PHP now has full support for the full range of Object Oriented techniques available. That means you can use namespaces, classes, objects, inheritance, control visibility, and use any of the tried and true design principles of computer science.
  • Best Documentation in Town The PHP documentation is arguably the best language documentation available for any of the modern languages. Every single function available is clearly documented, with community comments included for each function. These comments will be invaluable to you as you learn since many people before you have probably struggled with and solved whatever question you may have. You’ll find the code snippets to be super helpful.
  • Huge Development Community There are over 20 million websites on the internet that run PHP. That’s a lot of websites, and a lot of software developers that wrote all of the PHP to run those sites. Any problem you come across has most likely already been solved, all you have to do is learn how the language works, and learn to implement the code available to you. Once you have this skill, you can then make small tweaks and modifications to the code to make things work exactly as you’d like them to. It’s all very fun!
Powered by PHP

Powered by PHP

Getting Started with PHP

As we go through this PHP tutorial series, we’ll make every effort to cover the fundamentals of the language soup to nuts. These next articles are not for the advanced programmers out there, unless they want to come back and refresh the basics. In many ways, it’s the basics and the fundamentals that are the most fun to learn. So moving forward, we’ll have a lot of ground to cover. We’re going to need to get PHP installed in some way shape or form so that we can begin working with the language. We’ll set up some really cool testing tools so you can quickly test out the snippets and make your own. Once we have a bit of a foundation, we’ll start looking at all of the features of the language. Topics to cover include Data Types, Control Structures, Expressions, Logical Operators, Loops, Functions, Debugging, Forms, Sessions, Cookies, MySQL Database Basics, and more.

The What is PHP Summary

This was a fun crash course on the history of PHP and how we can begin to learn about it and leverage the language for our own projects. With over 20 million websites already using PHP, you’ll be in good company learning about the language as well.

Thank you for reading What is PHP?Please do share using the buttons below!

Thanks For Sharing! :-)Share on Google+Tweet about this on TwitterShare on RedditShare on FacebookShare on StumbleUponPin on PinterestShare on LinkedInShare on TumblrBuffer this page

Even More Awesome WordPress Fundamentals

Thanks For Sharing! :-)Share on Google+Tweet about this on TwitterShare on RedditShare on FacebookShare on StumbleUponPin on PinterestShare on LinkedInShare on TumblrBuffer this page

Even More Awesome WordPress Fundamentals

This WordPress Tutorial Series has been a blast! We’re learning all about WordPress and how to hit the ground running with our own website or blog. A lot of this is inspired by the indie web. The indie web is really something that resonates with vegibit, mainly that it encourages users of the internet to create and host their own platforms for having a voice. You should be in control of your data and online voice, and the only way to guarantee that is to do it yourself. Proprietary social networks are great for meeting and sharing, but put the bulk of your content on your own server. That’s the main goal with learning WordPress in this series. And with that thought, let’s look at even more awesome WordPress Fundamentals now!

Adding an Image from a Remote Source

We covered a lot about creating and uploading images in your WordPress site already. Those tips focused on using images from your own computer uploaded to the server via the media manager so they could be embedded in your content. It is also possible to embed images from third parties, if they so allow. You’ll want to make sure you are using an image from a source that encourages sharing and use. Don’t embed and image from the Apple website, lest you get a call from their legal department. For this example we’ll use an image from a cool site that encourages sharing images, pexels.

  1. Click Add Media  This will open the media library
  2. Choose Insert from URL  Paste in the actual URL which holds the image itself.  You’ll know if it is an image if the end of the URL has an image extention like .jpeg, .png. or .gif
  3. Click Insert Into Post  Click the button and you’ll see something like you do right here.

Use oEmbed to Embed Media with ease

WordPress makes use of a really cool protocol called oEmbed. So just what is oEmbed? Well, it’s a set of rules and procedures that allows one site to request from another for any HTML required to embed media from their site. So for example, we can post a standalone URL which is not hyperlinked into our editor on it’s own line. It’s really an incredible technology which mitigates the requirement of copying and pasting html in order to embed. Let’s try to embed a video. Now remember, all we are going to do is paste an url such as this one https://www.youtube.com/watch?v=xWflyooxABM on it’s own line, then preview the post.

Let’s check it out:

You See? Magic.

By using the oEmbed protocol, WordPress makes the process of embedding rich media super easy.

What Websites Does WordPress oEmbed Work With?

This list is quite long actually, but let’s just try a few of the more common ones. How about Twitter, Instagram, and Imgur.


We’ll use this url https://twitter.com/vegibit/status/511528479276269568


This is our url for instagram http://instagram.com/p/s8ZNZQRMTp/

My mountain men - #alberta #whpbwlandscapes

Photo Credit: http://instagram.com/estherleclerc


We’ll use this url http://imgur.com/gallery/mQCle5N


Very Slick! So we can see that by using oEmbed with WordPress, it is possible to easily add rich media to your content to great effect.

Using WordPress Revisions

WordPress Publish WidgetAs we mentioned during this WordPress Tutorial Series, WordPress makes use of a fantastic auto save feature as you are creating you content. In fact, if you pay attention, you can see in the Add New Post window a status will periodically get flashed to the screen that WordPress is Saving Draft…. This is great, and over the course of creating a piece of content, you may have many revisions. You can find these revisions by clicking the Browse Revisions link in the Publish Widget of the WordPress Dashboard. The image on the left shows what this looks like. In this case, there are only 4 revisions but when your content starts to hit two thousand words or more, you may have up to fifty different revisions saved during the course of your writing!

The Benefit of Revisions

There are many benefits to the fact of WordPress saving multiple revisions of your content. There may have been some text or an image that you had included in the post but then decided to remove it before the final post was published. What happens if you had a change of heart? Maybe you do want to include that text and image now. Well, you can come back to your post, even many days or months later and simply restore a prior revision. It’s fantastic that WordPress does this for you since at some point, you will run into a situation where relying on a prior revision will save you.

Publishing You WordPress Post

There are a few options for publishing your WordPress Post, and you can find these options in the same Publish Widget located in the WordPress Dashboard as we just covered in WordPress Revisions. They are as follows:

  • Status The status can be toggled between Draft, Pending Review, or Published. For a one person operation, these will always be either Draft or Published. If you do have multiple writers for your website, you can make use of the Pending Review option in order to have an editorial chief review any pending Posts.
  • Visibility This provides a few ways to change how the content in your Post is accessed. By default, it is set to Public, and when the status is Published, any new Posts will get pushed to the top of your homepage. You can also Sticky the post. You surely are familiar with the concept of Stick Posts. Sticky Posts are the ability to pin a post to the top of a section of your website regardless of new Posts being introduced into the stream. Twitter now also implements a sticky feature, and if you visit any popular discussion forums on the internet, you’ll also be familiar with the idea of making a topic or post Sticky. WordPress Posts can also be Private or Password Protected. Maybe you have a site where you only want to share sensitive information with users that should be authorized to view said content. In this case simply assign a password to the post and have the user provide credentials.
  • Publish By default, this is set to immediately. This means as soon as you click the Publish button, your post will go live on the site. If you would like to schedule the post to go live at a later time, this is the area you can do that in.
  • Publicize Not included by default in the WordPress base install, but a part of the popular WordPress JetPack plugin is the Publicize feature. This great tool allows you to link your social profiles to your WordPress account. This tool will monitor for new posts from your website, and when one goes live, the new post will be automatically distributed across any social networks you have connected. Most users will want to add Twitter, Facebook, and Google+ however you can also include Tumblr, LinkedIn and Path if you like.

Using More and Excerpts in WordPress

Once you have a collection of Posts published to your WordPress website, you can customize extensively how they are displayed. Some websites like this one, will allow the content to display fully, rather than giving a short snippet with a continue reading link. Even though we’re not using this feature per se, let’s take a look at how you can implement this if you so desire.  All you need to do is to navigate to the point in your article at which place you’d like to have it truncated when viewing on the front page, then click the Insert Read More tag button in your visual editor.

WordPress Insert More Tag

This is how you can achieve that summary effect on your front page, like you would often see on an online magazine style website.

Custom WordPress Excerpt

In addition to being able to use the Read More tag within a post, you can also make use of custom excerpts provided that the theme in use supports this. The way this works is to enable the Excerpt feature by navigating to screen options at the top of the Add New Post window, and make sure that the Excerpt checkbox is ticked. It is not checked by default, so you will need to turn it on if you’d like to try using a custom excerpt on your post. Once you have it checked off, a new form field will appear at the bottom of your editor where you can write a quick excerpt to replace the automatically generated text from the Read More tag. It’s a bit more labor intensive, but if you’re looking for the utmost in control of how your post will be presented on the front page of your site, then maybe this route is good for you. You’ll not that as you toggle options on and off in the Screen Options window of the admin dashboard, the updates to the screen happen in real time. There is no need to click a Save Changes button or anything like that. It just goes to show you that the developers of WordPress have really paid a very close attention to detail in providing the best possible content creation tool to you.

WordPress Post Formats

WordPress in its current iteration have support for different types of Post Formats. When you’re starting out creating your posts in WordPress, you’ll most likely be making use of the Standard Post Format. This is the format we have been working with throughout this WordPress Tutorial Series. There are several other formats available, let’s have a look.

  • Standard  The most commonly used format for creating your WordPress Posts.
  • Aside  The aside format is more of a status update, similar to something you might find on Twitter or Google Plus.
  • Image  Use this is the focus of your post is largely on an image.
  • Video  Likewise for focusing on a video as the main focal point of your post.
  • Quote  To create a post that is a quote, you can use this format type.
  • Link  Lastly, if you simply want to share a link with your readers, you can use this post format type.

Creating a WordPress Page

We mentioned earlier in this WordPress Tutorial Series what the difference is between WordPress Posts and WordPress Pages. We mentioned that WordPress Posts are going to be the primary means of creating new content for your website. WordPress posts will always get placed in the very top most position of your front page in a reverse chronological order. As such, we have spent a lot of time reviewing how we can create, update, and edit posts for our WordPress Powered website. Let’s now take a quick look at WordPress Pages, since they serve a useful purpose as well.

Used for Static Content

The perfect use for WordPress pages is something like an About page. For example, for VegiBit, we have an about page that lists basic information about the website. It would make sense for your website to include an about page as well. There are several things you can include such as:

  • General Information For general information you want to include a good overview for your new visitors that are curious about the topics covered.
  • Social Accounts Does your website have one or many social accounts? The about page is a great place to include them so your readers can connect with you.
  • Advertising If you offer advertising, the about page is also a great place to provide a means to purchase ads.

This is an example of a WordPress Page.

Pages in WordPress can have comments turned on or off, in addition to having social sharing buttons turned on or off. It really doesn’t make a whole lot of sense to use either of these on your static pages. With this static content, it will be updated only once in a great while, users will not likely have a need or desire to comment and share these pages. In addition to having an about page, it might makes sense to have several static WordPress Pages. Once your company grows to a point where you need to hire additional help, you would likely create a Careers page. Maybe you are getting asked the same questions over and over again about your company, website, or blog. Guess what, that’s another opportunity for a WordPress Page – an FAQ page, or Frequently Asked Questions page. These pages can then be customized and organized as needed.

The WordPress Awesome Fundamentals Conclusion

With this being our sixth episode in this WordPress Tutorial Series and over ten thousand words later, we’ve covered a lot of ground! We started by talking about what WordPress is and how we can best use it ourselves. By looking at all of the very popular people, businesses, and brands using WordPress, we validated it’s ability to support large high traffic websites. We also had a look at things like the WordPress Toolbar, the WordPress Dashboard, and how to create a new post in WordPress. There were a lot of details, but we got em covered! Then there was the process of dealing with hyperlinks and images in WordPress and the best way to organize them. Lastly, we took a look at even more WordPress fundamentals like using WordPress oEmbed for rich media, Post Formats, Page Formats, and more.

Thank you for reading Even More Awesome WordPress FundamentalsPlease do share using the buttons below!

Thanks For Sharing! :-)Share on Google+Tweet about this on TwitterShare on RedditShare on FacebookShare on StumbleUponPin on PinterestShare on LinkedInShare on TumblrBuffer this page