Edmonds Commerce Logo
  • home
    • blog
  • ecommerce
    • product catalogue
    • order processing
    • customer services
    • stock control
    • human resources
    • management information
  • development
    • oscommerce
    • php
    • mysql
    • open source
    • performance tuning
  • design
  • marketing
  • contact us
    • pricing

Edmonds Commerce Blog

Freelance PHP Ecommerce and SEO Developer in the UK

Latest Posts

Magento Natively Supports Google Website Optimizer
PHPNW08 - PHP Conference Up North!!
Javascript Debugging
Online Business Tools

Most Popular Posts

PHP Email Attachment Function Freelance osCommerce UK Ultimate osCommerce Checkout - Fast and Friendly PHP : Dead Easy Excel Export

Debugging PHP Scripts

March 17th, 2008
Read More debugging, php

When coding PHP, or more frequently when trying to customise or fix someone elses code, it can sometimes be tricky to figure out exactly what is going wrong.

In this kind of situation, it is often neccessary to go through the flow of the script and view the contents of the various strings and arrays at that stage of the script.

I have written this small function to help in this process:

PLAIN TEXT
PHP:
  1. function dbug($item){
  2.     echo '<hr><h3>Debug Info</h3><pre>' . (var_export($item, true)) . '</pre><hr>'; 
  3. }

This script will take any item and print out detailed information for you in a nicely formatted and easy to read way.

For an example when you might decide to use this functionality, you could check the contents of your $_POST

PLAIN TEXT
PHP:
  1. <?php
  2. /*very top of script */
  3. dbug($_POST);

Bookmark this Post
Add 'Debugging PHP Scripts' to Del.icio.usAdd 'Debugging PHP Scripts' to diggAdd 'Debugging PHP Scripts' to FURLAdd 'Debugging PHP Scripts' to blinklistAdd 'Debugging PHP Scripts' to redditAdd 'Debugging PHP Scripts' to Feed Me LinksAdd 'Debugging PHP Scripts' to TechnoratiAdd 'Debugging PHP Scripts' to Yahoo My WebAdd 'Debugging PHP Scripts' to NewsvineAdd 'Debugging PHP Scripts' to SocializerAdd 'Debugging PHP Scripts' to Ma.gnoliaAdd 'Debugging PHP Scripts' to Stumble UponAdd 'Debugging PHP Scripts' to Google BookmarksAdd 'Debugging PHP Scripts' to RawSugarAdd 'Debugging PHP Scripts' to SquidooAdd 'Debugging PHP Scripts' to SpurlAdd 'Debugging PHP Scripts' to BlinkBitsAdd 'Debugging PHP Scripts' to NetvouzAdd 'Debugging PHP Scripts' to RojoAdd 'Debugging PHP Scripts' to BlogmarksAdd 'Debugging PHP Scripts' to ShadowsAdd 'Debugging PHP Scripts' to Co.mments
Add 'Debugging PHP Scripts' to ScuttleAdd 'Debugging PHP Scripts' to BloglinesAdd 'Debugging PHP Scripts' to TailrankAdd 'Debugging PHP Scripts' to SegnaloAdd 'Debugging PHP Scripts' to OKnotizieAdd 'Debugging PHP Scripts' to NetscapeAdd 'Debugging PHP Scripts' to Bookmark.itAdd 'Debugging PHP Scripts' to AskAdd 'Debugging PHP Scripts' to SmarkingAdd 'Debugging PHP Scripts' to LinkagogoAdd 'Debugging PHP Scripts' to DeliriousAdd 'Debugging PHP Scripts' to SocialdustAdd 'Debugging PHP Scripts' to Live-MSNAdd 'Debugging PHP Scripts' to SlashDotAdd 'Debugging PHP Scripts' to SphinnAdd 'Debugging PHP Scripts' to DiggitaAdd 'Debugging PHP Scripts' to SeotribuAdd 'Debugging PHP Scripts' to FaceBookAdd 'Debugging PHP Scripts' to UpnewsAdd 'Debugging PHP Scripts' to WikioAdd 'Debugging PHP Scripts' to Social Bookmarking Reloaded

Feed | Respond | Trackback

Leave a Reply

  • RSS Feed
  • Categories

    • apache
    • barcode
    • business
    • creloaded
    • curl
    • customer services
    • debugging
    • ecommerce
    • email
    • excel
    • firefox
    • flash
    • gd
    • graphs
    • hosting
    • icecat
    • internet news
    • javascript
    • link building
    • linux
    • magento
    • management
    • mod_rewrite
    • mysql
    • oscommerce
    • php
    • plesk
    • product catalogue
    • product feed
    • programming
    • regular expressions
    • scraping
    • search engine optimisation
    • security
    • seo
    • spidering
    • ubuntu
    • vps
    • web design
    • web development
    • Windows
    • xampp
    • zip
  • Archives

    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
  • Tags

    addons advanced adverts blackhat blocking css development directories find firefox google hosts file html javascript keywords links msn mysql myths operators oscommerce paid links paid placement performance php ppc reciprocal linking replace screen scraping search engine optimisation security seo serp speed spider spidering tuning user friendly vista web web design web developer
  • Random Posts

    • PHP, cURL, CURLOPT FOLLOWLOCATION and open basedir Or Safe Mode
    • Advanced PHP Debug Function
    • MySQL Find and Replace
    • osCommerce Contribution Released: Server Migration Synchronisation
    • Advanced Google Search Queries
    • osCommerce Output Queries Debug : Store Speed Optimisation
    • PHP Email Attachment Function
    • SEO Service Providers - What to Check For:
    • Running Internet Explorer under Ubuntu Linux
    • PHP Generated SQL

Edmonds Commerce related questions? Send us a message or call us on 0844 357 0201.

Freelance PHP Web Design UK Commercial Web Design