473,382 Members | 1,635 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,382 software developers and data experts.

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 1198
["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
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...
11
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...
39
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)...
5
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...
11
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.