Skip to content

Instantly share code, notes, and snippets.

@netojoaobatista
Created February 8, 2013 21:31
Show Gist options
  • Save netojoaobatista/4742102 to your computer and use it in GitHub Desktop.
Save netojoaobatista/4742102 to your computer and use it in GitHub Desktop.
<?php
register_tick_function(function() {
foreach ($GLOBALS as $name => $value) {
if (is_string($value)) {
$GLOBALS[$name] = new String($value);
}
}
});
declare (ticks=1);
<?php
$string = 'João Batista Neto';
var_dump($string->explode(' '));
<?php
class String
{
private $value;
public function __construct($value)
{
$this->value = $value;
}
public function __toString()
{
return $this->value;
}
public function explode($sep)
{
return explode($sep, $this->value);
}
}
@alganet
Copy link

alganet commented Feb 9, 2013

HAHAHAHAHA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment