473,490 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Putting an array within an array?

Still having fun trying to build the perfect form and validation classes and
wondered if anyone can help on the following.

In the following function, how can I make $validationparameters an array so
it can accept multiple values that I can iterate through? Don't need the
iteration part (yet).

function setField($type, $name, $value, $style, $label,
$validationparameter)
{
$this->number_of_fields++;
$this->fields[] = array('type'=>$type, 'name'=>$name, 'value'=>$value,
'style'=>$style, 'label'=>$label,
'validationparameters'=>$validationparameters);
}

This is part written function that I will use to pass the multiple values to
the array.

function setValidationParameters($number, $parameter)
{
$this->fields[$number][validationparameter] = $parameter;
}

I am beginning to confuse myself and wondering if anyone can add some sanity
to what I am doing.

Cheers

Phil


Aug 24 '07 #1
2 1492
Ignore my post as I can't even type properly !!!

Cheers

Phil
Aug 24 '07 #2

"Phil Latio" <ph********@f-in-stupid.co.ukwrote in message
news:RA*********************@fe02.news.easynews.co m...
| Still having fun trying to build the perfect form and validation classes
and
| wondered if anyone can help on the following.

such an animal does not exist. ;^)

| This is part written function that I will use to pass the multiple values
to
| the array.
|
| function setValidationParameters($number, $parameter)
| {
| $this->fields[$number][validationparameter] = $parameter;
| }
|
| I am beginning to confuse myself and wondering if anyone can add some
sanity
| to what I am doing.

unless you are telling php that 'validationparater' should be interpreted as
a string value:

$this->fields[$number][validationparameter] = $parameter;

should be:

$this->fields[$number][$validationparameter] = $parameter;

however, where would it come from in that function. in either case, with the
code as-is as posted here, the value of the field with key $number will have
a blank array element and its value will be the value of the $parameter the
last time you called the function...which is probably not what you were
going for.

PLUS, please keep your casing consistent with best practices...either camel
case, pascal case, or underscore your variables:

$validationParameter;
$ValidationParameter;
$validation_parameter;

respectively.
Aug 24 '07 #3

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

Similar topics

15
2324
by: Bob | last post by:
I've tried everything; and I can't seem to get past this VERY (seemingly) simply problem. I want to work with an array variable within a function(s). I can't get it to work; if I: 1) global...
0
1304
by: WebRod | last post by:
Hi, see this code, i only set an array of array, then i copy this array in another one, do an unset and display both: $a=array("row1.1"=>"row1.1.1" , "row1.2"=>"row1.2.1"); $a =...
4
13058
by: John MacIntyre | last post by:
Hi, I have a page with a series of child pages loaded into an iframe. When I move from page to page, I store an object containing the child's control data in a variable on the main page, then...
0
1380
by: EMiller | last post by:
Hello, I am encountering a development challenge here that seems to be stumping me. I am developing a C#/.NET application using an MSDE database. There is a particular field in a table that I...
1
4192
by: jimbo | last post by:
Here is my problem. I'm creating an Instrumentation class that will use previously created Performance Categories and Counters in order to time various processes (ie. query duration etc.). This...
104
16845
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from...
7
8118
by: bowlderster | last post by:
Hello,all. I want to get the array size in a function, and the array is an argument of the function. I try the following code. /*************************************** */ #include<stdio.h>...
0
2172
by: Anish G | last post by:
Hi, I have an issue with reading CSV files. I am to reading CSV file and putting it in a Datatable in C#. I am using a regular expression to read the values. Below is the code. Now, it reads...
0
2393
by: drawing in aspnet | last post by:
Question about putting the data layer in a separate class library. I keep reading that the data layer should be separated from the presentation layer and put in its own class library. I am...
0
7112
marktang
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,...
0
6974
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7146
Oralloy
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,...
1
6852
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...
0
7356
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5448
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4878
isladogs
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...
0
4573
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...
0
277
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.