Hello,
I've pulled a bunch of numbers from a .txt file with fopen/fread, and I've put them into an array with explode().
However, when I try to compare them, it compares them as strings.
Example:
<?php
// $array[0] == "9"
// $array[1] == "10"
if($array[0] < $array[1])
echo("Yay!");
else
echo("No!");
?>
prints: No!
Since it's reading the numbers as a string, it's saying 10 comes before 9. Example: 1, 10, 2, 3, 4, 5, 6, 7, 8, 9
So I'm wondering if there's a way to convert the string to an int (which I don't think is possible) or at least compare these in a natural order--without using natsort()....