Page 1 of 1

what is wrong with this array:

Posted: Mon Nov 08, 2004 2:42 am
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" )

)
   

?>

?>

Posted: Mon Nov 08, 2004 2:51 am
by phpScott
what's the error message?

Error?

Posted: Mon Nov 08, 2004 2:52 am
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.

ok the problem is this :

Posted: Mon Nov 08, 2004 2:56 am
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

Posted: Mon Nov 08, 2004 4:42 am
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.

Posted: Mon Nov 08, 2004 5:12 am
by pelegk2
ow oppps my ,istake:)