i've seen few example here on stack don't seem cover scenario.
i'm attempting this;
$flight_range = array( array('range' => range(1,50), 'service' => 'long haul'), array('range' => range(51,54), 'service' => 'short haul'), .... ); but php won't let me. returns;
parse error: syntax error, unexpected '(', expecting ')' on line 02 this not work either;
array(range(1,50), range(51,54) ... the problem trying assign value of range().
i have 20+ sets of range values assign.
can suggest easy method achieving these sorts of array values?
edit; haike00, jack , sean right.
maybe question should how make $flight_range member variable of class;
private $flight_range = array(array('range' => range(1,50), 'service' => 'long haul'));
what problem doing in constructor?
class myclass { private $flight_range; public function __construct() { $this->flight_range = array( array( 'range' => range( 1, 50 ), 'service' => 'long haul' ) ); } }
Comments
Post a Comment