I see what my problem is but not sure what I need to change. I'm
reading a single number from a file that's fed into an array but the
array doesn't want to print out its output.
$oncall=array() ;
$oncall[1]="msims";
$oncall[2]="dtilbury";
$oncall[3]="jma";
$oncall[4]="jweaver";
$oncall[5]="cirwin";
$filename="onca ll/.oncall";
$n=file_get_con tents($filename );
echo "$oncall[$n]";
This prints nothing.
But when I comment out the file_get_conten ts and simply do $n="2" the
array prints out dtilbury like it should. My guess is the error lies
in how $n is being assigned from the file_get_conten ts. Any thoughts?
Much appreciation!
--Matt
reading a single number from a file that's fed into an array but the
array doesn't want to print out its output.
$oncall=array() ;
$oncall[1]="msims";
$oncall[2]="dtilbury";
$oncall[3]="jma";
$oncall[4]="jweaver";
$oncall[5]="cirwin";
$filename="onca ll/.oncall";
$n=file_get_con tents($filename );
echo "$oncall[$n]";
This prints nothing.
But when I comment out the file_get_conten ts and simply do $n="2" the
array prints out dtilbury like it should. My guess is the error lies
in how $n is being assigned from the file_get_conten ts. Any thoughts?
Much appreciation!
--Matt
Comment