Seems like a convoluted way to do whatever this is, but yeah, here's a simple way to generate that - all untested and may contain stupid bugs because I've got a headache, but here you go...
First build the array of weeks:
$marking = [ strtotime('sunday') * 1000 ]; for ( var $i = 1 ; $i <= 52 ; $i++ ) $marking[i] = strtotime((-1*$i).' week sunday') * 1000;
Then re-map each one into the desired format (use a better function name):
function convert_to_my_format( $CurMarking ) { return "{ xaxis: { from: ".($CurMarking+10000000).", to: ".($CurMarking-96400000)." }, color: \"#F3F3ED\" }"; } $markings = array_map( "convert_to_my_format" , $marking );
Finally convert that array into a comma-delimited string:
$markings = implode( "," , $markings );
for ( $i = 1 ; $i <= 52 ; $i++ ) $marking[i] = strtotime((-1*$i).' week sunday') * 1000; function convert_to_markings( $CurMarking ) { return "{ xaxis: { from: ".($CurMarking).", to: ".($CurMarking-96400000)." }, color: \"#F3F3ED\" }"; } $markings = array_map( "convert_to_markings" , $marking ); $markings = implode( "," , $markings );Output from that is
{ xaxis: { from: 1425168000000, to: 1425071600000 }, color: "#F3F3ED" }
...of an idiot who doesn't know what things are. :S
Hmm, bit harsh? Maybe just a dunce. (hug)
jQuery neither prefixes variable names not puts dollars in front of selectors. It aliases itself as $, and as a function it can have arguments, the first of which can be a selector, though it also can be other things, and also has various methods attached to the function's object itself.
Which is not to say it isn't a bit dumb, but it is at least more convenient than typing case sensitive jQuery, though even that isn't as $durbrained $as $bloody $_PHP.