Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8543105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:13:28+00:00 2026-06-11T12:13:28+00:00

i am trying to store data in a text file, something like an array

  • 0

i am trying to store data in a text file, something like an array into a text file using php instead of storing into mysql database.

for example here are the data to be stored in a text file

name=>john
age=>25
location=>australia

then after saving it to a text file , how can I get the contents out and parse it with php , for like php can find the name , age and location and echo it out(something like parsing an array)

I need it for storing the data into a text file so it can be easily access from other domains without requiring to be on the same domain , connect to database , get the data from database. I am looking for a speedy solution. 🙂

I’m not sure which direction should I look into for this kind of functionality , hoping someone can point me out.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:13:29+00:00Added an answer on June 11, 2026 at 12:13 pm

    Storing:
    1. Use serialize() to serialize your array into a string
    2. Write that string to text file using file_put_contents()

    Reading:
    1. Use file_get_contents to read text file
    2. Use unserialize() to unserialize previously serialized array

    serialize()/unserialize() can be replaced by json_encode()/json_decode()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to store data from a xml-file in a associative Array. Creating the
I'm trying to parse items in a text file and store them into a
I'm trying to read from XML and store the data in a text file.
I'm trying to store a set of data in a TEXT field in my
I'm trying to store some binary data obtained from read() in my buffer using
I am trying to develop a database to store data collected by a web
I am trying to retrieve particular data from a txt file and would like
Question abstract: how to parse text file into two hashes in Perl. One store
I'm trying to read a text file and store each line in a node
Suppose I have a text file with data like below, I want to read

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.