473,800 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with array - what's wrong??

Hi.

I'm using

<pre><?php print_r($_POST['dane']); ?>
</pre>
and i'm getting this:

Array
(
[1] => Array
(
[\'zamow\'] => Array
(
[0] => 1
)

)}

So then i tried

<pre><?php print_r($_POST['dane'][1]); ?>
</pre>

Array
(
[\'zamow\'] => Array
(
[0] => 1
)

)But when i'm trying with:<pre><?php print_r($_POST['dane'][1]['zamow']); ?>
</pre>I'm getting no resultsWhat is wrong? What should to see result?

Thanks
Leszek

Feb 1 '06 #1
1 1212
["Followup-To:" header set to comp.lang.php.]
Leszek wrote:
<pre><?php print_r($_POST['dane']); ?>
</pre>
and i'm getting this:

Array
(
[1] => Array
(
[\'zamow\'] => Array <snip>
<pre><?php print_r($_POST['dane'][1]); ?>
</pre>

Array
(
[\'zamow\'] => Array <snip>
)But when i'm trying with:<pre><?php print_r($_POST['dane'][1]['zamow']); ?>
</pre>I'm getting no resultsWhat is wrong? What should to see result?


The single quotes are part of the array index. If you want to print its
value you need to include the single quotes

<?php print_r($_POST['dane'][1]['\'zamow\'']); ?>

or

<?php print_r($_POST['dane'][1]["'zamow'"]); ?>

or even

<?php
$idxA = 'dane';
$idxB = 1;
$idxC = "'zamow'";
print_r($_POST[$idxA][$idxB][$idxC]);
?>

--
If you're posting through Google read <http://cfaj.freeshell. org/google>
Feb 1 '06 #2

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

Similar topics

18
1662
by: mrvendetta1 | last post by:
hi any hints would be great! #include <stdio.h> #define MySize 8 void FindPosition(int array); { int array1 = {0,0,0,0,0,1,0,1}; FindPosition(array1) void FindPosition(int array) { int counter;
11
2411
by: Leszek | last post by:
Hi I' m trying convert a php array to a javascript array like this: var danevar1 = "<? print $dane1; ?>"; var danearray1= new Array(); danearray1 = danevar1.split(","); var suma1=0; for(var i=0; i<danearray1.length; i++){ suma1=suma1+danearray1;
39
19655
by: Martin Jørgensen | last post by:
Hi, I'm relatively new with C-programming and even though I've read about pointers and arrays many times, it's a topic that is a little confusing to me - at least at this moment: ---- 1) What's the difference between these 3 statements: (i) memcpy(&b, &KoefD, n); // this works somewhere in my code
5
2563
by: weidongtom | last post by:
Hi, I tried to implement the Universal Machine as described in http://www.boundvariable.org/task.shtml, and I managed to get one implemented (After looking at what other's have done.) But when I use to run a UM program, I kept on getting error messages. I have used someone else's implementation and it runs fine. I have compared my code with other's and I still can't figure it out what's wrong with mine. So please help me out, after 3...
11
3368
by: venkatagmail | last post by:
I have problem understanding pass by value and pass by reference and want to how how they are or appear in the memory: I had to get my basics right again. I create an array and try all possible ways of passing an array. In the following code, fun1(int a1) - same as fun1(int* a1) - where both are of the type passed by reference. Inside this function, another pointer a1 is created whose address &a1 is different from that of the passed...
0
9695
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9555
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
10514
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
10287
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...
1
7588
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
5479
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...
1
4156
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
3770
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2956
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.