Jump to content

rascle

Members
  • Posts

    178
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Britain

rascle's Achievements

Member

Member (2/5)

0

Reputation

  1. But it isn't listing them how I want it, I'll have to do some more research unless you have any insights?
  2. Using the php.net I have come up with the following, but it is probably rubbish!: function sortdtr($a,$B){ $a = explode('x^',$a); $b = explode('x^',$B); if($a==$B){ return 0; } else if($a>$B){ return -1;} else if($a<$B){ return 1; } } usort($dtr, "sortdtr"); echo "<br/>"; print_r($dtr);
  3. But what would the function be?
  4. I havent got a solution but I can change the values so that x is x^1 and a constant is x^0. This might make it easier, all I need to know is how to order based on the value after "x^"
  5. Hi I have an array (which is an equation) lets say it is Array ( [0] => 18x [1] => 10x^2 [2] => 17 ) I want to order the array in terms of the value after ^, so that the highest values after ^ are grouped first. Therefore the above array I want it sorted to become Array ( [0] => 10x^2 [1] => 18x [2] => 17 ) Does anyone have any idea how I would sort it? I have tried using php sort() to no avail. Thanks, Rhys
  6. Sorry, that was the character encoding
  7. BTW on the DOM Parser, there is an error "Parse error: syntax error, unexpected '=' in /home/b25rasc/public_html/test9.php on line 2"
  8. Whats wrong with just using preg_match? As there is a lot less code?
  9. Thanks, sorry to be an idiot but how could I do that by getting the info from dump.text though? Thanks Rhys
  10. Thanks again, however I still cant get it to display anything, here is the code I am using: <?php $eurovalue = file_get_contents("dump.txt"); $eurovalue = htmlspecialchars($eurovalue); $pattern = '/<td><a.*>USD\/EUR<\/a><\/td>.*<td\s*\w*>\s*<img\s*[\w\d]*\s*\/>(\d+)<\/td>/si'; preg_match($pattern,$eurovalue,$euroarray); $euroresult = $euroarray[0]; echo $euroresult; ?> I dont know if there is any silly mistakes in there, dump.text is where the HTML is being loaded (and that is working fine). I use htmlspecialchars, as otherwise the output would be in HTML. I hope this doesnt affect the preg_match Thanks Again Rhys
  11. Thanks, but I've tried it and nothing is happening still. Unfortunately I dont know much about Regex and so cant see what you have done, but there are multiple <td></td> lines, does the provided code identify the one I want? <td><a href="/business/currencies/quote?srcAmt=1&srcCurr=USD&destAmt=&destCurr=EUR">USD/EUR</a></td> <td class="data changeUp"> <img width="9" height="10" src="/resources_v2/images/changeUp.gif" />0.69070</td> As there are similar bits of code, for example USD/GBP Thanks Rhys
  12. Basically the post with the long code isnt relevant, it is where the: <td><a href="/business/currencies/quote?srcAmt=1&srcCurr=USD&destAmt=&destCurr=EUR">USD/EUR</a></td> <td class="data changeUp"> <img width="9" height="10" src="/resources_v2/images/changeUp.gif" />0.69070</td> lies, basically I just want the code above to be found so need to create a regex to find the above code, in the long code, if that makes sense. Thanks Rhys
×
×
  • 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.