What do you want to save?
Add Code snippet
New code examples
-
PHP 2022-03-01 10:10:04
log data into file php
//Something to write to txt log $log = "User: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL. "Attempt: ".($result[0]['success']=='1'?'Success':'Failed').PHP_EOL. "User: ".$username.P... Add solution -
PHP 2022-01-23 07:30:21
php append line to file
// LOCK_EX will prevent anyone else writing to the file at the same time // PHP_EOL will add linebreak after each line $txt = "data-to-add"; $myfile = file_put_contents('logs.txt', $txt.PHP_EOL , FILE_APPEND | LOCK_EX); // Second option is this... Add solution -
PHP 2022-01-22 00:01:42
php save array to file
$arr1 = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5); file_put_contents("array.json",json_encode($arr1)); # array.json => {"a":1,"b":2,"c":3,"d":4,"e":5} $arr2 = json_decode(file_... Add solution -
PHP 2021-11-07 12:52:12
appending txt file from php
// LOCK_EX will prevent anyone else writing to the file at the same time // PHP_EOL will add linebreak after each line $txt = "data-to-add"; $myfile = file_put_contents('logs.txt', $txt.PHP_EOL , FILE_APPEND | LOCK_EX); // Second option is this... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5