473,378 Members | 1,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Data Structures

Is it possible to create data structures in PHP and if so, would someone
provide a bried example?

Example:

I would like to create a Data Structure JRec which has the following fields

lID (Long)
dtDate (Date)
sName (10 Character String)

Thanks.

Andrew
Dec 8 '05 #1
4 1358
Use objects, classes or arrays. See the PHP manual for more details.

Quick example:
<?php
$foo->lID = 10;
$foo->dtDate = date();
$foo->sName = "I like PHP";
?>

Dec 8 '05 #2
Sjoerd wrote:
Use objects, classes or arrays. See the PHP manual for more details.

Quick example:
<?php
$foo->lID = 10;
$foo->dtDate = date();
$foo->sName = "I like PHP";
?>

Thank you very much for your quick response ... another question ... if
you wanted to read/write data from/to a binary file, can you do this
from PHP?
Dec 8 '05 #3
Andrew Peskin wrote:
Sjoerd wrote:
Use objects, classes or arrays. See the PHP manual for more details.

Quick example:
<?php
$foo->lID = 10;
$foo->dtDate = date();
$foo->sName = "I like PHP";
?>

Thank you very much for your quick response ... another question ... if
you wanted to read/write data from/to a binary file, can you do this
from PHP?


I should add ... can you read/write to a binary file, whole objects, in
your example above, can you write $foo to a binary file, then read the
binary file and place the record into a new variable $foo1?
Dec 8 '05 #4
Andrew Peskin wrote:
I should add ... can you read/write to a binary file, whole objects, in
your example above, can you write $foo to a binary file, then read the
binary file and place the record into a new variable $foo1?


Yes. See http://php.net/serialize and fwrite/fread.
Also see http://php.net/download-docs.php

--
E. Dronkert
Dec 8 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: hzy_104 | last post by:
Please recommend book on data structures for searching(c++)?
1
by: Amit | last post by:
Hello, Can any of you recommend a really good book on data structures and more so, if it relates to STL data structures, and how they are used to build far more complex data structures. ...
5
by: el_roachmeister | last post by:
For being a good web programmer, is a course on data structures important? It seems php already has built-in functions for what they teach in a data structures course. On the other hand all...
4
by: Thomas Paul Diffenbach | last post by:
Can anyone point me to an open source library of /statically allocated/ data structures? I'm writing some code that would benefit from trees, preferably self balancing, but on an embedded system...
10
by: Bart Goeman | last post by:
Hi, I have a question about how to put redundant information in data structures, initialized at compile time. This is often necessary for performance reasons and can't be done at run time (data...
13
by: Leszek Taratuta | last post by:
Hello, I have several drop-down lists on my ASP.NET page. I need to keep data sources of these lists in Session State. What would be the most effective method to serialize this kind of data...
3
by: osp | last post by:
hi to every one.... i just started out with c++ and i think i am doing well.i use Robert Laffore to study. which book should i use for data structures ? please help. thank you with regards ...
11
by: efrat | last post by:
Hello, I'm planning to use Python in order to teach a DSA (data structures and algorithms) course in an academic institute. If you could help out with the following questions, I'd sure...
29
by: Mik0b0 | last post by:
Hallo to everyone. This fall I am going to start data structures as a part of C language course. The problem is I could not find any satisfying tutorial about structures in C. There are plenty of...
4
by: jehugaleahsa | last post by:
Hello: When developing data structures for C#, there is an obvious performance hit when utilizing primitive types. For instance, a recent hash table implementation I wrote works exceedingly fast...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.