473,378 Members | 1,420 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.

structures in php ?

How do you create data structures in php ?

i.e. how would I create the following two vb structures in php ?

Structure SYSTEMTIME
Dim wYear As Short
Dim wMonth As Short
Dim wDayOfWeek As Short
Dim wDay As Short
Dim wHour As Short
Dim wMinute As Short
Dim wSecond As Short
Dim wMilliseconds As Short
End Structure

Private Structure TIME_ZONE_INFORMATION
Dim Bias As Integer
Dim StandardBias As Integer
Dim DaylightBias As Integer
Dim StandardDate As SYSTEMTIME
Dim DaylightDate As SYSTEMTIME
End Structure

Also, if I read a binary value from the registry, how would I then convert it to a variable of type TIME_ZONE_INFORMATION
Many Thanks
--
Adrian Parker
Jul 17 '05 #1
6 41277
Adrian Parker wrote:
How do you create data structures in php ?

i.e. how would I create the following two vb structures in php ?

Structure SYSTEMTIME
Dim wYear As Short
Dim wMonth As Short
Dim wDayOfWeek As Short
Dim wDay As Short
Dim wHour As Short
Dim wMinute As Short
Dim wSecond As Short
Dim wMilliseconds As Short
End Structure

Private Structure TIME_ZONE_INFORMATION
Dim Bias As Integer
Dim StandardBias As Integer
Dim DaylightBias As Integer
Dim StandardDate As SYSTEMTIME
Dim DaylightDate As SYSTEMTIME
End Structure
Two solutions :
1/ the Q&D way : use an associative array :
$sys_time = Array();
$sys_time['wYear'] = 2004;
$sys_time['wMonth'] = 12;

etc...

2/ the clean way : use classes :

class SystemTime {
function SystemTime($year, $month, $dayOfWeek, [etc...]) {
$this->wYear = $year;
$this->wMonth = $month;
$this->wDayOfWeek = $dayOfWeek;

etc...
}
}
Also, if I read a binary value from the registry,
The *what* ?-)
how would I then

convert it to a variable of type TIME_ZONE_INFORMATION

ask a MS-Windows group...

Bruno

Jul 17 '05 #2
Ok, lets put it another way.

Say I have a blob in a db that was populated from another source.

when I select the blob, I just have binary data.. how do I split that up into the individual structure components ?
"Bruno Desthuilliers" <bd*****************@free.quelquepart.fr> wrote in message news:40***********************@news.free.fr...
Adrian Parker wrote:
How do you create data structures in php ?

i.e. how would I create the following two vb structures in php ?

Structure SYSTEMTIME
Dim wYear As Short
Dim wMonth As Short
Dim wDayOfWeek As Short
Dim wDay As Short
Dim wHour As Short
Dim wMinute As Short
Dim wSecond As Short
Dim wMilliseconds As Short
End Structure

Private Structure TIME_ZONE_INFORMATION
Dim Bias As Integer
Dim StandardBias As Integer
Dim DaylightBias As Integer
Dim StandardDate As SYSTEMTIME
Dim DaylightDate As SYSTEMTIME
End Structure


Two solutions :
1/ the Q&D way : use an associative array :
$sys_time = Array();
$sys_time['wYear'] = 2004;
$sys_time['wMonth'] = 12;

etc...

2/ the clean way : use classes :

class SystemTime {
function SystemTime($year, $month, $dayOfWeek, [etc...]) {
$this->wYear = $year;
$this->wMonth = $month;
$this->wDayOfWeek = $dayOfWeek;

etc...
}
}
Also, if I read a binary value from the registry,


The *what* ?-)
how would I then

convert it to a variable of type TIME_ZONE_INFORMATION

ask a MS-Windows group...

Bruno

Jul 17 '05 #3
Adrian Parker wrote:
How do you create data structures in php ?

i.e. how would I create the following two vb structures in php ?

Structure SYSTEMTIME
Dim wYear As Short
Dim wMonth As Short
Dim wDayOfWeek As Short
Dim wDay As Short
Dim wHour As Short
Dim wMinute As Short
Dim wSecond As Short
Dim wMilliseconds As Short
End Structure

Private Structure TIME_ZONE_INFORMATION
Dim Bias As Integer
Dim StandardBias As Integer
Dim DaylightBias As Integer
Dim StandardDate As SYSTEMTIME
Dim DaylightDate As SYSTEMTIME
End Structure

Also, if I read a binary value from the registry, how would I then convert it to a variable of type TIME_ZONE_INFORMATION
Many Thanks


PHP does not have support for Structures or structs in the traditional
sense. You can use an associative array instead to simulate the
structure and it's members.

--
Amir Khawaja.

----------------------------------
Rules are written for those who lack the ability to truly reason, But
for those who can, the rules become nothing more than guidelines, And
live their lives governed not by rules but by reason.
- James McGuigan
Jul 17 '05 #4
Thanks for the pointer.

"Amir Khawaja" <am**@gorebels.net> wrote in message news:B6LSb.12713$QJ3.11343@fed1read04...
Adrian Parker wrote:
How do you create data structures in php ?

i.e. how would I create the following two vb structures in php ?

Structure SYSTEMTIME
Dim wYear As Short
Dim wMonth As Short
Dim wDayOfWeek As Short
Dim wDay As Short
Dim wHour As Short
Dim wMinute As Short
Dim wSecond As Short
Dim wMilliseconds As Short
End Structure

Private Structure TIME_ZONE_INFORMATION
Dim Bias As Integer
Dim StandardBias As Integer
Dim DaylightBias As Integer
Dim StandardDate As SYSTEMTIME
Dim DaylightDate As SYSTEMTIME
End Structure

Also, if I read a binary value from the registry, how would I then convert it to a variable of type TIME_ZONE_INFORMATION
Many Thanks


PHP does not have support for Structures or structs in the traditional
sense. You can use an associative array instead to simulate the
structure and it's members.

--
Amir Khawaja.

----------------------------------
Rules are written for those who lack the ability to truly reason, But
for those who can, the rules become nothing more than guidelines, And
live their lives governed not by rules but by reason.
- James McGuigan

Jul 17 '05 #5
Adrian Parker wrote:
Ok, lets put it another way.

Say I have a blob in a db that was populated from another source.

when I select the blob, I just have binary data.. how do I split that up into the individual structure components ?


I'm not sure this will help, but you may want to have a look at :
http://www.php.net/manual/en/function.pack.php
http://www.php.net/manual/en/function.unpack.php
http://www.php.net/manual/en/function.bin2hex.php

Else you may have to manually parse your binary data.

About windows registry, STFW :
http://codingtheweb.partners.phpclas...kage/1426.html

HTH
Bruno

Jul 17 '05 #6
"Adrian Parker" <ap******@nospam.com> wrote in message news:<gI*****************@news-binary.blueyonder.co.uk>...
How do you create data structures in php ?

<snip>

Someone already gave you the hint. Anyway, see
<http://groups.google.com/groups?threadm=abc4d8b8.0401050125.4a59d9fc%40post ing.google.com>
for such previous discussion.

--
"I don't believe in the God who doesn't give me food, but shows me
heaven!" -- Swami Vivekanandha
Email: rrjanbiah-at-Y!com
Jul 17 '05 #7

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

Similar topics

1
by: kazack | last post by:
Hi all it's me again with another question as I got further in my book. The chapter I am in covers structres, abstract data and classes. I only read through to the end of the coverage on...
33
by: Peter Seaman | last post by:
I understand that structures are value types and arrays and classes are reference types. But what about arrays as members of structures i.e. as in C struct x { int n; int a; }
6
by: Ken Allen | last post by:
OK, I admit that I have been programming since before C++ was invented, and I have developed more than my share of assembly language systems, and even contributed to operating system and compiler...
7
by: John Dann | last post by:
I'm trying to read some binary data from a file created by another program. I know the binary file format but can't change or control the format. The binary data is organised such that it should...
14
by: pmclinn | last post by:
I've noticed that many programmers use classes to store data about such things like: Class Customers .....Phone ....ID ....Address End Class....
2
by: thomasfarrow | last post by:
At work, our development team has a development standards document that insists Structures should never be used. I'm looking to change this standard but need a suitable argument in order to make...
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...
44
by: svata | last post by:
Hello, I wonder how to resize such array of structures using realloc()? #include <stdio.h> #include <stdlib.h> #define FIRST 7 typedef struct { char *name;
4
by: cleanrabbit | last post by:
Hello! I hate having to do this, because im almost certain there is someone in the world that has come across this problem and i just havent found their solution yet, so i do appologise if this...
8
by: Bob Altman | last post by:
Hi all, I have a structure that includes a constructor. I want to add a bunch of these structures to an STL map (whose index is an int). If I define the map like this: map<int,...
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: 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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.