Perl to PHP

Discussion in 'PHP' started by star2323, Mar 6, 2006.

  1. #1
    Ok I need some help with converting some Perl code to PHP again.

    
    &get_input;
    
    $alpha = $in{'alpha'};
    $n=$in{'n'};
    if($n eq "") {
    	$n = 0;
    }
    $next = $n+50;
    
    Code (markup):
    The first line I'm not sure what it does.
    Is "$in{'alpha'}" an array and it is getting the value in the "alpha" position?
    Same with line 3? Where are the values in the array "$in" coming from?


    Thanks
     
    star2323, Mar 6, 2006 IP
  2. ryan_uk

    ryan_uk Illustrious Member

    Messages:
    3,983
    Likes Received:
    1,022
    Best Answers:
    33
    Trophy Points:
    465
    #2
    I guess that isn't the whole script?
    I don't know perl, but get_input is to do with form GET?

    $alpha = $_GET['alpha'];

    if alpha is passed by get...

    Maybe $n is $_GET

    so...

    $alpha = $_GET['alpha'];
    $n = $_GET['n'];
    if($n == NULL) {
    	$n = 0;
    }
    $next = $n + 50;
    PHP:
     
    ryan_uk, Mar 9, 2006 IP
  3. FeedBucket

    FeedBucket Well-Known Member

    Messages:
    159
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #3
    &get_input is a call to the get_input function -- probably where $in is getting set.
     
    FeedBucket, Mar 9, 2006 IP
  4. ryan_uk

    ryan_uk Illustrious Member

    Messages:
    3,983
    Likes Received:
    1,022
    Best Answers:
    33
    Trophy Points:
    465
    #4
    as that's the case, then star2323 it is best posting the whole script or paying someone to convert from perl-to-php if you prefer not to reveal the whole script.

    P.S. instead of $_GET use $in if the fields alpha and n aren't coming from a form (using get).

    Good luck!
     
    ryan_uk, Mar 10, 2006 IP