Saving text into array into a file

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
marasovec
New php-forum User
New php-forum User
Posts: 4
Joined: Tue Mar 20, 2018 9:56 am

Tue Mar 20, 2018 10:04 am

Hi, I'm new in PHP and I need some help. I'd like to save some strings into array and then store the array into txt or something. And when I reload the page I need to load the array and then add some strings again.

Or is possible to put the array into javascript?

User avatar
hyper
php-forum Fan User
php-forum Fan User
Posts: 740
Joined: Mon Feb 22, 2016 5:52 pm

Tue Mar 20, 2018 10:11 am

It's not very clear what you intend to do, but I think what you are looking for is json encode and decode or serialize and unserialize if you want to save your arrays to a file.

User avatar
phpRob
New php-forum User
New php-forum User
Posts: 65
Joined: Mon Feb 26, 2018 7:15 am

Tue Mar 20, 2018 10:22 am

600 posts for hyper with that! congrats and always glad to see what hyper has to say. And in this case, I second what hyper says. Familiarize yourself with those links as they are key. And if you don't get them, google and read until you get them. That is your ticket.

marasovec
New php-forum User
New php-forum User
Posts: 4
Joined: Tue Mar 20, 2018 9:56 am

Tue Mar 20, 2018 10:46 am

hyper wrote:
Tue Mar 20, 2018 10:11 am
It's not very clear what you intend to do, but I think what you are looking for is json encode and decode or serialize and unserialize if you want to save your arrays to a file.
Thanks

Post Reply