1--TEST-- 2Test copy() function: basic functionality 3--FILE-- 4<?php 5echo "*** Testing copy() function: to copy file from source to destination --\n"; 6 7var_dump( file_exists(__FILE__) ); 8 9/* copying the file */ 10$file_path = __DIR__; 11$file_name1 = $file_path."/copy_basic1.tmp"; 12$file_name2 = $file_path."/copy_basic2.tmp"; 13var_dump( copy(__FILE__, $file_name1) ); 14var_dump( copy($file_name1, $file_name2) ); 15 16echo "-- Checking whether the copy of file exists --\n"; 17var_dump( file_exists($file_name1) ); 18var_dump( file_exists($file_name2) ); 19 20echo "-- Checking filepermissions of file and its copies --\n"; 21printf( "%o", fileperms(__FILE__) ); 22echo "\n"; 23printf( "%o", fileperms($file_name1) ); 24echo "\n"; 25printf( "%o", fileperms($file_name2) ); 26echo "\n"; 27 28echo "*** Done ***\n"; 29?> 30--CLEAN-- 31<?php 32$file_path = __DIR__; 33$file_name1 = $file_path."/copy_basic1.tmp"; 34$file_name2 = $file_path."/copy_basic2.tmp"; 35unlink($file_name1); 36unlink($file_name2); 37?> 38--EXPECTF-- 39*** Testing copy() function: to copy file from source to destination -- 40bool(true) 41bool(true) 42bool(true) 43-- Checking whether the copy of file exists -- 44bool(true) 45bool(true) 46-- Checking filepermissions of file and its copies -- 47%d 48%d 49%d 50*** Done *** 51