sscanf not assigning variable...?

Discussion in 'PHP' started by Theruchet, Jul 21, 2010.

  1. #1
    Hi,

    I'm trying to use sscanf to get the 4th number from the output of a program, like so:

    
    $output = "Total 52 4 24 24 0 0 0";
    sscanf($output, "Total %d %d %d %d %d %d %d", $gar1, $gar2, $gar3, $gar4, $gar5, $gar6, $gar7);
    echo "Number four: ".$gar4;
    
    //Output: Number four:
    
    Code (markup):
    However, when I try this on a separate test php page it works fine and outputs Number four: 24, just like it should. Any ideas why this is not working in the context of my page?

    Also, in the context of my program I checked the return value (number of variables assigned), which =0.

    Thanks!
     
    Theruchet, Jul 21, 2010 IP