Welcome Guest, Not a member yet? Register   Sign In
How to integrate Python with PHP?
#8

(This post was last modified: 01-19-2020, 11:50 AM by jreklund.)

@christaliise: You can't do it like you want. You will need to read the entire file into memory and append the new data at the beginning and saving it again.

$a = file_get_contents('filename.txt');
$b = 'New information' . $a;
file_put_contents('filename.txt', $b);

Regarding the reverse part, it depends on what you are storing. Can it be parsed and stored in an array?
https://www.php.net/manual/en/function.a...everse.php

And as you can't do this in PHP. Don't do it. It will give you problems down the road. So live with the limitation and redesign your application.
Reply


Messages In This Thread
RE: How to integrate Python with PHP? - by jreklund - 01-19-2020, 11:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB