I am working on an embedded platform. Disk storage is at a premium, so
I am trying not to add any more stuff....
I am reading and writing some data that the user enters through a
webform. The form is an operations schedule for a piece of equipment.
Basically, the schedule consists of repeated actions by the machine, and
it is very simple:
%f %f %d %d %d %d %d
repeated about 10 or 15 times.
I will be storing the data in associative arrays, so I would like a
simple way to write the data in a format easily read by a human.
So, instead of the simple line of numbers, I would like something like this:
< Schedule
< Line
< From %f >
< To %f >
< Op1 true >
< Op2 true >
< Op3 false >
< Op4 true >
</ Line>
.... [more lines as needed]
</ Schedule>
I was thinking of XML, but it looks as though XML uses external libs and
is fairly complex to use in PHP....
Since the data is stored in an associative array basically using the
above structure, is there a way to dump an array to file and then read
it back?
Something like print_r, but using file ops and also a read_r to read it
into the array?
Bascially, I am looking for the simplest way to create something that
looks sort of like XML.... 5 1720
Hi,
You might try to serialize an array and deserialize it later. http://www.php.net/serialize
Captain Dondo wrote: I am working on an embedded platform. Disk storage is at a premium, so I am trying not to add any more stuff....
I am reading and writing some data that the user enters through a webform. The form is an operations schedule for a piece of equipment.
Basically, the schedule consists of repeated actions by the machine, and it is very simple:
%f %f %d %d %d %d %d
repeated about 10 or 15 times.
I will be storing the data in associative arrays, so I would like a simple way to write the data in a format easily read by a human.
So, instead of the simple line of numbers, I would like something like this:
< Schedule < Line < From %f > < To %f > < Op1 true > < Op2 true > < Op3 false > < Op4 true > </ Line> ... [more lines as needed] </ Schedule>
I was thinking of XML, but it looks as though XML uses external libs and is fairly complex to use in PHP....
Since the data is stored in an associative array basically using the above structure, is there a way to dump an array to file and then read it back?
Something like print_r, but using file ops and also a read_r to read it into the array?
Bascially, I am looking for the simplest way to create something that looks sort of like XML....
Captain Dondo wrote: I am working on an embedded platform. Disk storage is at a premium, so I am trying not to add any more stuff....
I am reading and writing some data that the user enters through a webform. The form is an operations schedule for a piece of equipment.
Basically, the schedule consists of repeated actions by the machine, and it is very simple:
%f %f %d %d %d %d %d
repeated about 10 or 15 times.
I will be storing the data in associative arrays, so I would like a simple way to write the data in a format easily read by a human.
So, instead of the simple line of numbers, I would like something like this:
< Schedule < Line < From %f > < To %f > < Op1 true > < Op2 true > < Op3 false > < Op4 true > </ Line> ... [more lines as needed] </ Schedule>
I was thinking of XML, but it looks as though XML uses external libs and is fairly complex to use in PHP....
Since the data is stored in an associative array basically using the above structure, is there a way to dump an array to file and then read it back?
Something like print_r, but using file ops and also a read_r to read it into the array?
Bascially, I am looking for the simplest way to create something that looks sort of like XML....
How about the WDDX functions? http://fi.php.net/wddx
Chung Leong wrote: Bascially, I am looking for the simplest way to create something that looks sort of like XML....
How about the WDDX functions? http://fi.php.net/wddx
Wow! That looks really interesting....
Do you happen to know if there is a C parser for wddx? Google finds
nothing...
My backend is written in C....
Hi,
I hope I didn't get you wrong, but assuming you don't need any DOM
operations, you can just build a string containing your XML and write it
to a file with file_put_contents($filename).
To read it, you could use (PHP 5-only) the build-in SimpleXML-API, which
is very fast and easy to handle for reading purposes: http://www.php.net/manual/en/ref.simplexml.php
For PHP 4, you could include the also easy to handle XML-Parser from the
PEAR repository: http://www.php.net/manual/en/ref.simplexml.php
Captain Dondo wrote: I am working on an embedded platform. Disk storage is at a premium, so I am trying not to add any more stuff....
I am reading and writing some data that the user enters through a webform. The form is an operations schedule for a piece of equipment.
Basically, the schedule consists of repeated actions by the machine, and it is very simple:
%f %f %d %d %d %d %d
repeated about 10 or 15 times.
I will be storing the data in associative arrays, so I would like a simple way to write the data in a format easily read by a human.
So, instead of the simple line of numbers, I would like something like this:
< Schedule < Line < From %f > < To %f > < Op1 true > < Op2 true > < Op3 false > < Op4 true > </ Line> ... [more lines as needed] </ Schedule>
I was thinking of XML, but it looks as though XML uses external libs and is fairly complex to use in PHP....
Since the data is stored in an associative array basically using the above structure, is there a way to dump an array to file and then read it back?
Something like print_r, but using file ops and also a read_r to read it into the array?
Bascially, I am looking for the simplest way to create something that looks sort of like XML.... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dave Smithz |
last post by:
Hi there,
As a newbie to PHP is it in anyway possible for a casual web surfer to
actually get to see the PHP behind my .php file.
E.g.
if index.php contained PHP code to check if the page...
|
by: Maxim Khesin |
last post by:
I want to have a config file with my python proggie, satisfying the
following requirements:
1) support key->(value, default)
2) simple and intuitive to read and edit
3) easyly readable into a...
|
by: aj |
last post by:
DB2 WSE 8.1 FP5
Red Hat Linux AS 2.1
I am working on a Java-Swing based interface for a DB2 database,
and want to display more human-readable error meesages to the
end user when/if a database...
|
by: John Baro |
last post by:
I need to determine which fonts are human readable.
Webdings, wingdings etc.. are not.
Is there any easy way to accomplish this?
Cheers
JB
|
by: mphanke |
last post by:
Hi,
can somebody tell me how to convert the date from a Paradox .DB to human
readable format?
I need to write a tool to convert the 4 Bytes representing the date to a
human readable format.
...
| |
by: KenFehling |
last post by:
Hello. I am wondering if there exists a piece of software that takes
multiple .js files that are nicely indented and commented and create
one big tightly packed .js file. I'm hoping the one file...
|
by: Sanyog Garg |
last post by:
hi
I want to open a binary file that contains information in Ulong, Int and char form. now i want to convert this file into human readable form so that i can read the information contained in this...
|
by: Rob Weir |
last post by:
On 13 Aug 2008, rkmr wrote:
http://mail.python.org/pipermail/python-list/1999-December/018519.html
is a good start - just need to change the table to something like::
_abbrevs =
(and add a...
|
by: August Karlstrom |
last post by:
Hi,
I'm looking for a function that *returns* a human readable string
representation of an array rather than prints it so I can use it with
the error_log procedure. Any clues?
August
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |