$ string [$ k] = $ function [$ k]
defined in a foreach loop with index $ k. I want $ string to be defined as
$string[$k] = $function[$(k-5)]
except that it is not true. So for $ k = 8 I would have
$string[8] = $function[3]
How can I achieve this?
thank
Your version:
Correct version:
$string[$k] = $function[$k-5]
Try the following:
$string[$k] = $function[$k-5];
(Andrew Hare suggested this already, but for some reason he deleted it.)
Question: Is $ function an array [] or a function call ()?
If $ function is an array, you should not refer to $ function [k-5], where k <5;
your for loop should read:
for ($k=5; $k<$limit; ++k) $string[$k] = $function[$k-5];