简体   繁体   中英

Check if array index is greater than value in loop

I am running through an basic for loop like this:

@for ($i = 0; $i < $count; $i++)
$('#sliderAppendNumCh').append(
'<div>'+{{ $i + 1 }}+' Name: <input type=\"text\" value=\"{{ $work[$i]['name'] }}\">'
 +'</div>');
@endfor

for loop is created with laravel blade (php) and inside it I just append some data from my database.

Is it possible to check if

$i in $work[$i]['name']

My question: Is creater than count, and removing the value if that happens(and keep appending afterwards empty inputs)?

也许这个?

value=\"{{ ($work[$i]['name'] < $count) ? $work[$i]['name'] : '' }}\"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM