-1

I am trying to read/write a one dimensional array into a file. Which is faster method to do this for read/replace?

  • Serializing the array into the file, then loading it back again
  • Using XML
  • Using INI

Thank you

Rami Dabain
  • 4,709
  • 12
  • 62
  • 106
  • The only reliable way is to benchmark and find out. Unless the file is going to be 100kb big, the difference is probably going to be negligeable though – Pekka Feb 12 '13 at 13:20
  • the array is about 1000 elements , each element have 100 chars max – Rami Dabain Feb 12 '13 at 13:22

1 Answers1

2

I think, it depends on the data types and how you use it.
There is one more method you haven't mentioned: JSON (if you don't have to save the data types, takes less space than serialized array).
This may help: Preferred method to store PHP arrays (json_encode vs serialize)

Community
  • 1
  • 1
lvil
  • 4,326
  • 9
  • 48
  • 76