Imad Posted May 16, 2008 Share Posted May 16, 2008 Hi guys, is their a function like: file_put_contents() that's compatible with PHP 4 & 5? Best Regards. Link to comment https://forums.phpfreaks.com/topic/105852-need-help-with-php4-compatibility/ Share on other sites More sharing options...
Fadion Posted May 16, 2008 Share Posted May 16, 2008 file_put_contents() was introduced in php5, so its compatible. If ure on php4 u can use fopen() and fwrite() as also stated in the manual: This function [file_put_contents] is identical to calling fopen(), fwrite() and fclose() successively to write data to a file. A simple example: <?php $handle = fopen('myfile.txt', 'w'); $content = 'This is some text to be written'; fwrite($handle, $content); fclose($handle); ?> EDIT: Just to note that php4 is discontinued and use of php5 is encouraged. Link to comment https://forums.phpfreaks.com/topic/105852-need-help-with-php4-compatibility/#findComment-542570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.