php - Foreach iteration not working -
php - Foreach iteration not working -
i got key values in array variable. here iterate array , execute it.
foreach ($key_details $index => $value) { # code... $result = $s3->deleteobjects(array( 'bucket' => content_bucket, 'objects' => array( array('key' => $value), ) )); } here each time need create instance. if possible iterate this
# code... $result = $s3->deleteobjects(array( 'bucket' => content_bucket, 'objects' => array( foreach ($key_details $index => $value) { array('key' => $value), } ) )); }
you can't utilize foreach within array declaration - hence parse error: unexpected t_foreach.... instead, though, create info objects first, utilize deleteobjects parameter.
$objects = array(); foreach ($key_details $value) { $objects[] = array('key' => $value); } $result = $s3->deleteobjects(array( 'bucket' => content_bucket, 'objects' => $objects )); php arrays
Comments
Post a Comment