Skip to content

Instantly share code, notes, and snippets.

@crock
Last active February 15, 2018 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crock/fbc1e8a4b820fa4d530cab1a7fb53ace to your computer and use it in GitHub Desktop.
Save crock/fbc1e8a4b820fa4d530cab1a7fb53ace to your computer and use it in GitHub Desktop.
My personal collection of utility functions for PHP
<?php
class accorelib {
/**
* Prints out contents of variable surrounded with <pre> tags for easier analysis
*
* @param [Any] $variable - the variable to print out to page
* @return void
*/
public function pretty_dump(Any $variable) {
echo '<pre>' . var_dump($variable) . '</pre>';
}
/**
* Reads whole file and returns content
*
* @param String $filename
* @return void
*/
public function read_file(String $filename) {
$fx = fopen($filename, 'r');
$content = fread($fx, filesize($filename));
fclose($fx);
return $content;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment