473,791 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem With Arrays Of Arrays, PHP 5.2.0, Windows

$aThePosts = array_change_ke y_case($_POST, CASE_LOWER);

define("CONTACT _IS_LOCAL", 0);
define("CONTACT _IS_REMOTE", 1);

/* $aWho contains an array of arrays (contact details)
* array(
* array(0, CONTACT_IS_LOCA L, "My Local Contact",
* "123 Any Street", "Suite 123",
* "Phoenix", STATE_ARIZONA, "01234-5678",
* array(800, "867-5309", "867-5309",
* "1-800-000-0000", "867-5309"),
* "www.example.co m"),
* array(1, CONTACT_IS_REMO TE, ...
*/
function WhichContact() {
global $aThePosts, $aWho;

if (isset($aThePos ts['idWho'])) {
$iWhich = $aThePosts['idWho'];
$iWhichCheck = $aWho[$iWhich][0];
if ($iWhichCheck == $iWhich) {
return($iWhich) ;
}
}
return(-1);
}

I'm running into some strange problems. Sometimes,
$aWho[$iWhich][0] turns into the index number I expect,
and sometimes it returns "array[0]".

For instance, when I insert the following code after a call
to the above.

$iWho = WhichContact();
echo("<p class=\"pc\">$i Who</p>\n");
echo("<p class=\"pc\">" . $aWho[$iWho][0] . "</p>\n");
echo("<p class=\"pc\">$a Who[$iWho][0]</p>\n");

Inside the quotes, $aWho[$iWho] turns into "array" and
the string "[0]" gets added to it. Outside of the quotes
it returns the number I expect to get back.

But then when using that inside the function to verify
that a POST variable actually matches up with the index
of the client, the comparisons fail to match.

PHP 5.2.0 (cli) (built: Nov 2 2006 11:57:36)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

Is there a way to check the internal storage type of any
particular variable?

The POST variable is a value from an HTML

<form action="./" method="POST">
<select name="idWho">
<option value="0">Local Contact</option>
<option value="1">Remot e Contact</option>
</select>
</form>

--
Jim Carlock
Post replies to the group.
Jan 29 '07 #1
0 1102

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

Similar topics

7
11778
by: csx | last post by:
Hi everyone! two quick questions relating to arrays. Q1, Is it possible to re-assign array elements? int array = {{2,4}, {4,5}}; array = {2,3}
10
19158
by: Mark Jerde | last post by:
I'm trying to learn the very basics of using an unmanaged C++ DLL from C#. This morning I thought I was getting somewhere, successfully getting back the correct answers to a C++ " int SumArray(int ray, int count)" Now I'm having problems with C++ "return(false)" being True in C#. Here is the C# code. ========================= using System; using System.Runtime.InteropServices; //
2
4454
by: ajikoe | last post by:
Hi, I tried to follow the example in swig homepage. I found error which I don't understand. I use bcc32, I already include directory where my python.h exist in bcc32.cfg. /* File : example.c */ #include <time.h>
7
4037
by: HeatherS | last post by:
We are having issues with our windows services using memory and never releasing it. We have one service that has a file watcher which takes an xml file, inserts some records into a database, and creates a bunch of PDFs with Crystal Reports. Another service is a remote object which serves as our data access component -- basically it just executes stored procedures and returns datasets. If you watch the services in task manager, you can...
14
12199
by: rohitpatel9999 | last post by:
Hi While developing any software, developer need to think about it's possible enhancement for international usage and considering UNICODE. I have read many nice articles/items in advanced C++ books (Effective C++, More Effective C++, Exceptional C++, More Exceptional C++, C++ FAQs, Addison Wesley 2nd Edition) Authors of these books have not considered UNICODE. So many of their
12
3414
by: garyusenet | last post by:
I have had no replies to my previous post so perhaps I didn't write it good enough. Please excuse new thread but i wanted to break from the last thread hopefully this thread will be better. Very simple. I would like to create listviewitem's for display in a listview control. The listview items need to contain properties from Internet Explorer windows i've managed to collect into an arraylist.
9
2519
by: weidongtom | last post by:
Hi, I've written the code that follows, and I use the function add_word(), it seems to work fine *before* increase_arrays() is called that uses realloc() to allocate more memory to words. But *after* calling increase_arrays(), I received segmentation fault. I tried to step it through gdb, and I found out that after calling increase_arrays(), words's original value is modified, and if I tried to access it, I get <address 0x11 out of...
1
1976
by: Alhazred | last post by:
I'm writing a client-server software which should emulate an email service on a local machine. I'm now at the beginning and I'm trying to let communicate the client and the server process, but have a problem with GetMailslotInfo() in the server process inside the main() which returns with error code 1 which means "Invalid Function" though it looks correct to me. Can you understand why does that happen? You can see the code here:...
16
2549
by: mike3 | last post by:
(I'm xposting this to both comp.lang.c++ and comp.os.ms- windows.programmer.win32 since there's Windows material in here as well as questions related to standard C++. Not sure how that'd go over at just comp.lang.c++. If one of these groups is too inappropriate, just take it off from where you send your replies.) Hi.
43
2391
by: John | last post by:
Hi This .net is driving me crazy!! In VB6 I had a type which contained a couple of multi-dimentional arrays which i used to create and read records: Type AAA : Array1(10,10,2) as Integer
0
9515
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10426
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
9029
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...
0
6776
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();...
0
5430
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4109
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
3713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2913
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.