too long

I have the following array and I want to sort the array, by value.

(
    [bwin] => Array
        (
            [0] => Array
                (
                    [bookie] => bwin
                    [id_bookie] => 178537
                    [value] => 6.00
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => 1
                )

            [1] => Array
                (
                    [bookie] => bwin
                    [id_bookie] => 178537
                    [value] => 1.45
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => 2
                )

            [2] => Array
                (
                    [bookie] => bwin
                    [id_bookie] => 178537
                    [value] => 4.50
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => x
                )

        )

    [NordicBet] => Array
        (
            [0] => Array
                (
                    [bookie] => NordicBet
                    [id_bookie] => 201581
                    [value] => 5.75
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => 1
                )

            [1] => Array
                (
                    [bookie] => NordicBet
                    [id_bookie] => 201581
                    [value] => 1.50
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => 2
                )

            [2] => Array
                (
                    [bookie] => NordicBet
                    [id_bookie] => 201581
                    [value] => 4.30
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => x
                )

        )

    [Canbet] => Array
        (
            [0] => Array
                (
                    [bookie] => Canbet
                    [id_bookie] => 176582
                    [value] => 5.60
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => 1
                )

            [1] => Array
                (
                    [bookie] => Canbet
                    [id_bookie] => 176582
                    [value] => 1.56
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => 2
                )

            [2] => Array
                (
                    [bookie] => Canbet
                    [id_bookie] => 176582
                    [value] => 3.80
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => x
                )

        )

    [Expekt] => Array
        (
            [0] => Array
                (
                    [bookie] => Expekt
                    [id_bookie] => 235615
                    [value] => 5.60
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => 1
                )

            [1] => Array
                (
                    [bookie] => Expekt
                    [id_bookie] => 235615
                    [value] => 1.50
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => 2
                )

            [2] => Array
                (
                    [bookie] => Expekt
                    [id_bookie] => 235615
                    [value] => 4.25
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => x
                )

        )

    [StanJames] => Array
        (
            [0] => Array
                (
                    [bookie] => StanJames
                    [id_bookie] => 243649
                    [value] => 5.50
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => 1
                )

            [1] => Array
                (
                    [bookie] => StanJames
                    [id_bookie] => 243649
                    [value] => 1.53
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => 2
                )

            [2] => Array
                (
                    [bookie] => StanJames
                    [id_bookie] => 243649
                    [value] => 4.00
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => x
                )

        )

    [Gamebookers] => Array
        (
            [0] => Array
                (
                    [bookie] => Gamebookers
                    [id_bookie] => 203620
                    [value] => 5.00
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => 1
                )

            [1] => Array
                (
                    [bookie] => Gamebookers
                    [id_bookie] => 203620
                    [value] => 1.50
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => 2
                )

            [2] => Array
                (
                    [bookie] => Gamebookers
                    [id_bookie] => 203620
                    [value] => 4.25
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => x
                )

        )

    [Tipp3] => Array
        (
            [0] => Array
                (
                    [bookie] => Tipp3
                    [id_bookie] => 292604
                    [value] => 4.10
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => 1
                )

            [1] => Array
                (
                    [bookie] => Tipp3
                    [id_bookie] => 292604
                    [value] => 1.50
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => 2
                )

            [2] => Array
                (
                    [bookie] => Tipp3
                    [id_bookie] => 292604
                    [value] => 3.40
                    [bettype] => 3way
                    [line] => 0.0
                    [bet] => x
                )

        )

)

This is the unsorted array output, but I want to sort the array where the line is 2, but the line will be changing, sometimes I have to sort where the line is x or 1.

enter image description here

You can use usort. Here's a small snippet. You can do pretty much want you want in this function.

function sorting_function($x, $y)
{
    if ($x['value'] == $y['value'])
        return 0;
    else if ($x['value'] < $y['value'])
        return -1;
    else
        return 1;
}

usort($table_array, 'sorting_function');

PHP is pretty cruddy at dealing with multi-dim arrays. There are a number of solutions in the comments on the php sort function page, and it would be pretty redundant to post them all here... read through them, try some of them out, see which ones you like.

That data looks tab-delimited. If so, split each line based on the tab character and store it in an array. from there, its trivial to either throw out empty cells. A custom sort function that takes an array of those arrays, and an int for the column to sort on(index representing the column number) should be easy to do from there as well.