Sign in to follow this  
Followers 0
okpp

Array Question

2 posts in this topic

Dim $aArray[2]

$aArray['a'] = "AA"

$aArray['b'] = "BB"

Msgbox(0,'Array:' , $aArray['a']) ;;; return "BB"

Why?

--------------javascript-----------------

<script language='javascript'>

<!--

var arr = new Array();

arr['a'] = "AA";

arr['b'] = "BB";

alert(arr['a']); // return "AA"

//-->

</SCRIPT>

--------------php Script--------------

<?php

$arr = array(

"a" => "AA",

"b" => "BB",

);

echo $arr["a"]; // return "AA"

?>

Share this post


Link to post
Share on other sites



AutoIt does not convert characters to numeric values like php. In fact both 'a' and 'b' will evaluate to zero in this usage.

Thus:

Dim $aArray[2]

$aArray['a'] = "AA" ;assigned to element 0

$aArray['b'] = "BB" ;overwrites previous assignment

For $i = 0 to 1

MsgBox(4096,$i, $aArray[$i])

Next


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0