Jump to content

Linus Gates

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Linus Gates's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Below is an oversimplified version of my code. The reason being, I only really need to convey the idea of what I need to do.... [code]<?php $info = '(THE STRING THAT CONTAINS ALL THE DATA I NEED TO SORT)'; $info = explode("\n",$info); foreach($info as $results){ preg_match('/SOME REGEX CRITERIA HERE/', $results, $name); preg_match('/SOME REGEX CRITERIA HERE/', $results, $deducttions); preg_match('/SOME REGEX CRITERIA HERE/', $results, $income); $person[name] = $name[0]; $person[name] = $deducttions[0]; $person[income] = $income[0]; echo"$person[name] $person[deducttions] $person[income]<br />"; } ?>[/code] The above code basically takes a string of text that is NOT available in a database, filters out only the data I need, and then assigns the values I need to their corresponding variables. Up to that point, the [color=blue][b]$person[/b][/color] array looks like this: [code] Array ( [name] => Joe Blow [deducttions] => 10 [income] => 38,873  ) Array ( [name] => Bob Smit [deducttions] => 100 [income] => 1,038,873  ) Array ( [name] => Mister Smith [deducttions] => 25 [income] => 420,873  ) [/code] In turn, it echos out as such: [color=blue]Joe Blow 10 38,873 Bob Smith 100 1,038,873 Mister Smith 25 420,873[/color] [u]Question[/u]: What I actually need done, is to echo out the rows/results of the [color=blue][b]$person[/b][/color] array, in order from greatest to least, using the value of [color=blue][b]$person[/b][income][/color]. So when printed or echoed out, it would look like below, regardless of the original order. : [color=blue]Bob Smith 100 1,038,873 Mister Smith 25 420,873 Joe Blow 10 38,873[/color] Thanks in advance and I hope I was clear enough.  :)
×
×
  • 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.