How do I get the last element of an array 'g3' inside old() without knowing the number of elements.
<select name="g3[]" multiple="multiple">
<option value="1" @if (old('g3')=="1" ) {{ 'selected' }} @endif >lifting</option>
<option value="2" @if (old('g3')=="2" ) {{ 'selected' }} @endif >jogging</option>
<option value="3" @if (old('g3')=="3" ) {{ 'selected' }} @endif >sleeping</option>
</select>
<div {!! old('g3') != 3 ? '':' style="display: none"' !!}> Not to be seen</div>
How do I get the item selected inside div.