Results 1 to 2 of 2

Thread: Can someone convert this simplePHP code

  1. #1
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default Can someone convert this simplePHP code

    I have no idea how to do anything I mean ANYTHING in PHP and I need this code to be converted for a script I am working

    PHP Code:
    function experience($L) {
      
    $a=0;
      for(
    $x=1$x<$L$x++) {
        
    $a += floor($x+300*pow(2, ($x/7)));
      }
      return 
    floor($a/4);
    }

    for(
    $L=1;$L<100;$L++) {
      echo 
    'Level '.$L.': '.experience($L).'<br />';
    }
    ?> 
    Last edited by JPHamlett; 08-15-2010 at 04:49 AM.

  2. #2
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Converted to what? SCAR/Simba?
    SCAR Code:
    program new;

    function Experience(L : integer) : integer;
    var
      a, x : integer;
    begin
      for x := 1 to l - 1 do
        a := a + floor(x + 300 * pow(2, (x / 7)));
      result := floor(a / 4);
    end;

    var
      l : integer;
    begin
      for l := 1 to 99 do
        writeln('Level ' + ToStr(l) + ': ' + ToStr(Experience(l)));
    end.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •