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 Link to comment https://forums.phpfreaks.com/topic/28377-array-question-quick/ 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] Link to comment https://forums.phpfreaks.com/topic/28377-array-question-quick/#findComment-129792 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. Link to comment https://forums.phpfreaks.com/topic/28377-array-question-quick/#findComment-129810 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.