deep_copy.php 396 B

1234567891011121314151617181920
  1. <?php
  2. namespace DeepCopy;
  3. use function function_exists;
  4. if (false === function_exists('DeepCopy\deep_copy')) {
  5. /**
  6. * Deep copies the given value.
  7. *
  8. * @param mixed $value
  9. * @param bool $useCloneMethod
  10. *
  11. * @return mixed
  12. */
  13. function deep_copy($value, $useCloneMethod = false)
  14. {
  15. return (new DeepCopy($useCloneMethod))->copy($value);
  16. }
  17. }