Skip to content

Instantly share code, notes, and snippets.

@giorgiosironi
Created September 19, 2012 16:36
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 giorgiosironi/3750655 to your computer and use it in GitHub Desktop.
Save giorgiosironi/3750655 to your computer and use it in GitHub Desktop.
<?php
function byReference(&$d)
{
$d = new DateTime('1990-01-01');
}
function byValue($d)
{
$d = new DateTime('1990-01-01');
}
$date = new DateTime('2011-03-04');
byReference($date);
echo '$date: ' . $date->format('Y-m-d');
$date = new DateTime('2011-03-04');
byValue($date);
echo '$date: ' . $date->format('Y-m-d');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment