Skip to content

Instantly share code, notes, and snippets.

@m-e-h
Created June 19, 2018 21:17
Show Gist options
  • Save m-e-h/81b0c90e5a3cedf11f57c7703ef193bb to your computer and use it in GitHub Desktop.
Save m-e-h/81b0c90e5a3cedf11f57c7703ef193bb to your computer and use it in GitHub Desktop.
Gravity forms field array/string to array
<?php
$string = $gv_entry->entry['30'];
// Remove brackets.
$string = trim( $string, '[]' );
$post_ids = array_map(
function( $string_id ) {
// Remove quotes around IDs.
return trim( $string_id, '"' );
},
explode( ',', $string )
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment