Can someone please let me know how to add elements to an empty PHP array?
There are 2 ways.
<?php $marks = array(); $marks[] = 45; $marks[] = 85; ?>
or
<?php $marks = array(); array_push($marks, 45); array_push($marks, 85); // Or $marks = array(); array_push($marks, 45, 85); ?>
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
There are 2 ways.
or