what is wrong with this array:

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

what is wrong with this array:

Post by pelegk2 »

i a mreciving an error o nthis array structure why?

Code: Select all

<?php

<?
$archivos=Array
(   Array(["index"] => 0, ["name"] => "test")

   ,
       Array(["index"] => 0, ["name"] => "watertaxi.jpg" )

   ,
       Array(["index"] => 0,  ["name"] => "2_0003.JPG"  )

   ,
       Array( ["index"] => 0, ["name"] => "24A_0025.JPG" )

   , Array
       ( ["index"] => 1,["name"] => "_CIMG3501.JPG" )

)
   

?>

?>
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

what's the error message?
User avatar
AnarKy
Forum Contributor
Posts: 119
Joined: Tue Nov 02, 2004 1:49 am
Location: South Africa

Error?

Post by AnarKy »

What is the error?

Please give us the error message.
Perhaps say what it is you're trying to do?
There may be a better way for the declaration.
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

ok the problem is this :

Post by pelegk2 »

this is the new array :

Code: Select all

<?php
$fruits = array (
    "fruits"  => array("a" => "orange", "b" => "banana", "c" => "apple"),
    "numbers" => array(1, 2, 3, 4, 5, 6),
    "holes"   => array("first", 5 => "second", "third")
)

  echo print_r($fruits);
?>
and i recive the message :
Parse error: parse error, unexpected T_ECHO in C:\Program Files\Apache Group\Apache2\htdocs\test\sort.php on line
User avatar
Crom
Forum Newbie
Posts: 8
Joined: Mon Nov 08, 2004 2:50 am
Location: Ukraine
Contact:

Post by Crom »

Your array is ok :)
print_r outputs result itself. There is no need to put "echo" before it. Error is caused because you didn't put ";" after array declaration.
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

Post by pelegk2 »

ow oppps my ,istake:)
Post Reply