需要你的帮助,如何使用php中的三元运算符删除空数组值这是我的代码
<?php
$explode_values = array();
if (isset($checkpointvalues[$checkpoint['id']]['description'])) {
$explode_values = explode(",",@$checkpointvalues[$checkpoint['id']]['description']);
}
$a = array();
for ($i = 0 ; $i < count($explode_values); $i++) {
$a[$explode_values[$i]] = $explode_values[$i];
}
var_dump($a);
var_dump($explode_values);
?>
{!! Form::select($checkpoint['id'].'_c[]', isset($error_messages[$checkpoint['id']]) ?$error_messages[$checkpoint['id']] : (count($explode_values) > 0 ? $a : array()),'' , array('multiple'=>'multiple', 'class'=>'form-control js-example-tags select2','id'=>$checkpoint['id'].'_c')) !!}