How to get array data to output only intger PHP -
currently on dev site i'm using array output number of players , total players on server.
via line $info['players'] = $server_cache_data[1];
it shows
1601.5.1/5empirecraft - factions - pvp!0250
as can see on website here
how output in intger (numbers)?
i have tried string_resize($server_cache_data[1], 4)
down 4 hoping stop no luck.
thank time in advanced.
note output can see being feed 2 arrays players , total players controlled $info['maxplayers'] = $server_cache_data[2];
you can use php's type juggling functionality:
echo intval("1601.5.1/5empirecraft - factions - pvp!0250" + 0);
this returns first integer number regardless of how many digits number has.
note: works if number first part in string.
Comments
Post a Comment