PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of Filippo Toso   PHP Formatter   sample.php   Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Sample file
Class: PHP Formatter
Reformat PHP source code using the PHP tokenizer
Author: By
Last change:
Date: 18 years ago
Size: 548 bytes


Class file image Download
// include the phpformatter class
require_once ('phpformatter.class.php');
// create a new object
$phpformatter = new phpformatter ();
// load PHP source code
$code = file_get_contents ('phpformatter.class.php');
// get the formatted code
$formatted = $phpformatter->format_string ($code);
// As an alternative it's possible to call the class methods as static
// phpformatter::format_string ($code);
// phpformatter::format_file ($filename);

// print the formatted code in a beautiful way
highlight_string ($formatted);