473,796 Members | 2,585 Online
Bytes | Software Development & Data Engineering Community
+ 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 $validationpara meters 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,
$validationpara meter)
{
$this->number_of_fiel ds++;
$this->fields[] = array('type'=>$ type, 'name'=>$name, 'value'=>$value ,
'style'=>$style , 'label'=>$label ,
'validationpara meters'=>$valid ationparameters );
}

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

function setValidationPa rameters($numbe r, $parameter)
{
$this->fields[$number][validationparam eter] = $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 1510
Ignore my post as I can't even type properly !!!

Cheers

Phil
Aug 24 '07 #2

"Phil Latio" <ph********@f-in-stupid.co.ukwro te in message
news:RA******** *************@f e02.news.easyne ws.com...
| 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 setValidationPa rameters($numbe r, $parameter)
| {
| $this->fields[$number][validationparam eter] = $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 'validationpara ter' should be interpreted as
a string value:

$this->fields[$number][validationparam eter] = $parameter;

should be:

$this->fields[$number][$validationpara meter] = $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...whic h is probably not what you were
going for.

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

$validationPara meter;
$ValidationPara meter;
$validation_par ameter;

respectively.
Aug 24 '07 #3

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

Similar topics

15
2348
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 $arr=array(); (syntax err) 2) global $arr; in "main", the var isn't global 3) global $arr; in function, the array is cleared each time
0
1319
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 = array("row2.1"=>"row2.1.1", "row2.2"=>"row2.2.1"); print_r($a);
4
13235
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 use that data to populate the controls when the child page is opened again. One of these objects contains an Array, and the page reloads fine using myArray, myArray, etc... But when I try perform some array methods on it (i.e.slice) ... it does...
0
1407
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 need to accept a two-dimensional array of integers. When creating the database, I chose the SQL_Variant datatype for this column to which I will be writing the array.
1
4237
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 Instrumentation class will be used by a variety of "services", so the Categories and Counters to be used within the object must be set during object construction. So I created a class variable array of: private static PerformanceCounter...
104
17016
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 that array Could you show me a little example how to do this? Thanks.
7
8136
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> #include<stdlib.h> #include<math.h>
0
2197
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 CSV file without any issues only if all the fields are not null. If any field is blank, it moves the values to the left and displays the value under invalid column. Example is shown below: A part of CSV file. I am reading the first row as...
0
2410
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 trying to do this but running into a problem. I'm hoping someone can point me in the right direction. I first create a class library (all code in C#) and within this class library create a very simple Sql Server Express database (.mdb) file. It's...
0
10452
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10221
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.