473,237 Members | 1,248 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,237 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 41271
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,...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.