Christopher J. Crane wrote:
> I am a PERL scripter and I am just getting into PHP. My first few pages are
> simple but I am running into a few problems when changing OS. I included
> below a piece of code that works fine in windows but not on a linux box. Not
> sure what the differences would be....
> 
> The problem is that on the windows platform all information is returned. On
> the linux platform the "$Details" variable is not populated. The nothing
> changes...so what could it be. The only thing I can think of is that maybe
> the version of php is different on the linux server.
> 
> Here is the code.....after reading in a file with "|" deliminations
> while ($i < $length):
>    $tok = strtok($cartFile[$i],"|");
>     $Category = $tok;   $tok = strtok("|");
>     $SKU = $tok;    $tok = strtok("|");
>     $Name = $tok;    $tok = strtok("|");
>     $SubCategory = $tok;  $tok = strtok("|");
>     $Price = $tok;    $tok = strtok("|");
>     $Image1 = $tok;    $tok = strtok("|");
>     $Image2 = $tok;    $tok = strtok("|");
>     $OnSale = $tok;    $tok = strtok("|");
>     $SalePrice = $tok;   $tok = strtok("|");
>     $Details = $tok;   $tok = strtok("|");
> 
It could be a different version - what are the versions on the two systems?

In the meantime, could you not use explode() or split() instead?

list($category,$sku,$name,$sub,$price,$etc) = split("|",$cartFile[$i]);
(might need to be "\|" instead of "|" - I can't remember, it's late,
and I don't have easy access to test it.  :0


---------------------------
Michael Kimsal
http://www.phphelpdesk.com
734-480-9961


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to