Skip to content

Instantly share code, notes, and snippets.

@tomohiro
Created December 16, 2009 08:04
Show Gist options
  • Save tomohiro/257677 to your computer and use it in GitHub Desktop.
Save tomohiro/257677 to your computer and use it in GitHub Desktop.
Ruby のようなメソッドを PHP でも再実装
<?php
/**
* ex.
* include 'ruby_like.php';
*/
function puts($args)
{
print $args;
}
function p()
{
foreach(func_get_args() as $argments) {
var_export($argments);
}
}
function pp()
{
foreach(func_get_args() as $argments) {
var_dump($argments);
}
}
function h($string, $quote_style = null, $charset = null)
{
return htmlspecialchars($string, $quote_style, $charset);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment