forced time in seconds to hex ?

i want to make a hexadecimal value for every second in a 24 hours period, which i thought the code would look simular to such:
ini_set(‘max_execution_time’, -1);
function str_hex($string){
for ($i=0; $i < strlen($string); $i++){
$hex .= dechex(ord($string[$i]));
return $hex;
$time = $H.":".$M.":".$S;
echo “’”.str_hex($time)."’,";

i am expecting 86,400 results, but am getting only 320.

This code seems to work fine for me.

The probable cause for you must be either of the following.

  1. The ini set to increase must not be working
  2. The maximum execution time of the script must be really low in ur php.ini settings. i.e. ur script is taking longer time than the set up time

please try adding this to ur script also


NOTE: 3600 means no.of seconds

i thought by setting[php] ini_set(‘max_execution_time’, -1); [/php]set it to unlimited execution time.

i set the following in php.ini on my home server running; DamnSmall, php5.3.1, & on my wamp server
though i still only get 320 of the 84,600 expected.

max_execution_time = 3600 ; Maximum execution time of each script, in seconds
max_input_time = 3600 ; Maximum amount of time each script may spend parsing request data
#max_input_nesting_level = 128 ; Maximum input variable nesting level
memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)

can u give me more details of it? i mean does it hang up? or jst completes execution after displaying 320 records? what is it?

again, i’d like assure u that it worked fine in my local server as well as remote server.

apparently i forgot to save the php.ini before i restarted the services.
that fixed it…
though why would setting max_execution_time to -1 not work?

also it seems that changing
[php]echo “’”.str_hex($time)."’,";[/php] to [php]echo “’”.str_hex($time)."’,

was what i was missing… i had all the values on one line, and the browser only went so far, i would say less then a 10th the total lenth of the string. oops.

glad that u got it fixed.

Sponsor our Newsletter | Privacy Policy | Terms of Service