Papermashup

Latest Posts


Subscribe


Tweets


"@bethgordon @KBedders @elerichardson manners!"

@ashleyford 2 weeks ago

"Pulling a full moonie with @bethgordon @KBedders @elerichardson https://t.co/kb7RSWeGjG"

@ashleyford 2 weeks ago
Papermashup

PHP

Originally created by Rasmus Lerdorf in 1994, the PHP reference implementation is now produced by The PHP Group.

PHP Cookies

We will be looking at using cookies in PHP, not the cookie you enjoy eating, but the cookie as a tool for web development. We will examine what a cookie is, discuss how to create one, learn about how to delete and modify them. In web dev a cookie is a tool used to identify a user. A cookie is a small file that is embedded by the server on [...]

AshleyAshley

PHP array to CSV Function

Sometimes we need to export and convert data from a database into a CSV format that can be downloaded and manipulated for other purposes. This function will loop through the multi dimensional array and convert the data to CSV format and output the download to the browser forcing the headers to download the file. The Code

AshleyAshley

PHP Clever Caching

This clever bit of code checks if a page has been modified since it was last displayed and if it hasn’t, it sends a “304 not modified” header and exits, otherwise the content is loads as normal. Add the code below to the top of each PHP page you want to apply it to. It’s especially useful if you serve static content [...]

AshleyAshley

Show Google Plus’s – PHP function

Following on from yesterdays function to get likes and share data for a URL here’s a function to get Google Plus’s for any URL. The Code It’s worth pointing out you must have CURL enabled on your web server, I believe it’s enabled by default on PHP5 setups. Also the Key below Isn’t a unique API key you must leave [...]

AshleyAshley

Display Facebook likes / Shares PHP function

We launched a new product at Harkable last week called Daily Pulse – which tracks social data for any URL, you can also subscribe to receive email reports. I thought i’d share a bit of functionality similar to how we engineer Daily Pulse. The Code Below is a super simple function that retrieves a JSON feed of comments, likes and [...]

AshleyAshley

6 Useful PHP code snippets

Here’s a selection of really useful PHP code snippets that I find using on a weekly basis. You could use these as is or expand them as part of other applications or add them to a php class. Adjust server time If you have a server in a different timezone to you then you might be seeing funny things happen when you add the time to a MySQL [...]

AshleyAshley

Country drop down list with PHP function

I had a project recently that required the user to select their country from a drop down list and store the data in a database. It was such a long process setting up the PHP switch statement that I thought someone might find it useful for a project. The code below is a snapshot of the switch statement I’ve setup. The download at the [...]

AshleyAshley