Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About villermen

  • Rank
  1. Also, now I added that just a quick question.How do I reference to the new class function from the uasort's second argument? $bar$foofunction somefunction() { uasort($someArray,"???"); }function sorter($arg1,$arg2) { $this->bar $this->foo etc.. }
  2. Alright, I'll define those variables in the main class.I was just wondering if anything like that was possible, it would keep my code more logical/clean. Thanks again =)
  3. Ok, the deal is as follows: I've got a function in a class.Within that function is another function called by uasort(), a custom array sorting function.The main function contains some variables which should be used in the sorting function.However I do not know how they can be accessed, and they can't be included as extra arguments in the function because the uasort only allows 2. Example: function somefunction() { $bar=5; $foo=4; function sorter($arg1,$arg2) { $bar & $foo should be accessed from here... } uasort($someArray,"sorter"); } If there's any way to access $bar & $foo f
  4. Oh, bit of a fail there =S Thank you very much.
  5. The situation is:I got a file with over a million lines of text.I need to search for something in the last, say 1000, lines.Is there a possible way of starting the search at the end of the file without costing too much resources? (like skipping to the amount of lines -1000 using fread()) My backup solution would be to fetch the file's size and then fseek(filesize("file")-$alotofbytes) in it, I have no idea how resource-consuming this is however. Thanks for your time. Gr.Viller
  6. Ok the deal is: I got 2 tables, the last one can be resized by the content.At the end of the page I've placed a javascript function to resize the first to the last's width, like this: <table id="playerInfo"> contents (always smaller than playerStats)</table><table id="playerStats"> contents</table><script type='text/javascript'> document.getElementById('playerInfo').style.width=document.getElementById('playerStats').style.width;</script> This doesn't work at all, mainly in the last part "document.getElementById('playerStats').style.width" (this also can'
  7. It's a fast (maybe too incomplete) example I made, the real one is multidimensional.In a way of uhh..$example["first"]["a"]=<value>;
  8. Well thank you very much, I didn't know that! (not that that is new to me =)
  9. This could be a simple solution, but I don't fully get the $key1=>$value1Is this a method for getting the key instead of the value?Thanks already, big help
  10. Yes I know, but that is not the point, I didn't want to use foreach because I have to do it with 2 arrays simultaneously ($example1 and $example2), I can't loop through 2 arrays with foreach at the same index.
  11. Ok, I'll just jump right into the example: $example=array("first","second","third","fourth","fifth"); Now I want to cycle through this array (values will be added before the cycle) without using foreach, as I need to cycle through 2 arrays simultaneously. It will look something like this: for ($i=0;$i<100;$i++) { echo $example[$i]; } Is there any way I can accomplish this without using foreach or creating another array with the values as keys an strings as values?Gr.Villermen
  12. Couldn't find anything about this on the internet, so I'll just ask it here.My JavaScript code will not work because I can't use getElementsByName twice.I tried to fix this by using names, but I can't think of a solution now. <table> <tr class="dung_row" name="row8"> <td class="dung_column" name="column1"> </td> <td class="dung_column" name="column2"> </td> <td class="dung_column" name="column3"> </td> <td class="dung_column" name="column4"> </td> <td class="dung_column" name="column5"> </td&
  13. meh, i'll type you the full echo... <?phpecho "<form><input onchange='this.value=this.value.replace(/[^0123456789]/g,\"\");' /></form>";?> As you can see I have to backslash it otherwise PHP will mess it up
  14. it's an input tag in a form <form><input onchange='this.value=this.value.replace(/[^0123456789]/g,\"\");' /></form> like this. It will just be echoed as shown there
  • Create New...