Jump to content

Array sorting


gwolgamott

Recommended Posts

Okay my grasp on arrays just seems whacked lately... I can understand them one day and not another... anyways issue I have is this:

 

$Array_indexed[0] = "Something1";
$Array_indexed[1] = "Something1!sub1!partA";
$Array_indexed[2] = "Something1!sub2"; 
$Array_indexed[3] = "Something2";

 

take that exampled of what I have and I want to sort it in some sort of an array that after I delimit element 2 or 3... somehow make an overall array using multidimensional arrays. This is where I get lost and seem I can't get it to sort and go into something like this:

 

$array_multi[0] = "Something1";
$array_multi[0][0] = "sub1";
$array_multi[0][0][0] = "part A";
$array_multi[0][1]="sub2";
$array_multi[1] = "Something2";

 

Or do I have this all wrong? I have a feeling I'm thinking of this in the wrong way.

Link to comment
https://forums.phpfreaks.com/topic/189995-array-sorting/
Share on other sites

you CAN make multi dimensional arrays, however, you need to specify whether or not it will be an array..

 

2 examples

 

$array = array();

$array[0] = array();

$array[0][0] = "hi";

$array[0][1] = "howdy!";

$array[1] = array();

$array[1][0] = "hello";

$array[1][1] = "omgosh!";

 

example number two:

 

$array = array(array("hi","howdy"),array("hello","omgosh!"));

Link to comment
https://forums.phpfreaks.com/topic/189995-array-sorting/#findComment-1002599
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.