Ninjakreborn Posted November 24, 2006 Share Posted November 24, 2006 I have seen a lot of people do $variable = new array(array, variables, here);and that is what I see people telling me, and see in tutorialsWHen I do that, I ALWAYS get error messages, so I had to always do$variable = array(array, variables, here);why is that Quote Link to comment Share on other sites More sharing options...
onlyican Posted November 24, 2006 Share Posted November 24, 2006 new is used for class'sI normally do something like[code]<?php$my_array = (1 => "Something", 2 => "Something");#OR$my_array[1] = $something;$my_array[2] = $something;//You dont need the numbers, but I use them as I use it for references[/code] Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 24, 2006 Share Posted November 24, 2006 The "new Array" is used in javascript which is very similar to PHP. Perhaps that is part of the confusion. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.