note 116568 modified in function.rename by salathe

From: Date: Fri, 06 Feb 2015 13:07:23 +0000
Subject: note 116568 modified in function.rename by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-201615@lists.php.net to get a copy of this message
[Editor note: this works because SplFileObject has the __toString() method which returns the file path] Note that you can pass an SplFileInfo object as either argument: <?php # Assume a file 'foo' in the current directory rename('foo', new SplFileInfo('bar')); # foo is now bar! rename(new SplFileInfo('bar'), 'foo'); # bar is now foo again ?> --was-- Note that you can pass an SplFileInfo object as either argument: <?php # Assume a file 'foo' in the current directory rename('foo', new SplFileInfo('bar')); # foo is now bar! rename(new SplFileInfo('bar'), 'foo'); # bar is now foo again ?> http://php.net/manual/en/function.rename.php

« previous php.notes (#201615) next »