I need to get a string between the first parentisis that opens and the last one that closes, to then make a str_replace between those parentheses, finally perform an explode to get the fields.
Something like this:
$string = field1,field2,(if(isnull(table.id_),1,table.id_)) as field3,field4;
The function to call has to get this part of the code. (if (isnull (table.id _), 1, table.id_)) then:
$string_btwn_parenthesis = [(if(isnull(table.id_),1,table.id_))]; <- obtained by function
I want to get this - > (if (isnull (table.id _), 1, table.id _)) < - no - > (if (isnull (table.id _) < -, 1, table.id _))
$string_replaced = str_replace($string_btwn_parenthesis," ",$string);
$arrayfields = explode(",",$string_replaced);