bcworkz You my friend are a legend!!!!
Thank you very much. That worked for me.
I am interested now though how to return a friendlier array in the first place as you suggested.
I’m currently calling the data using
$main_array = get_option('_s_membership_pricing_rules');
from the wp_options table in the database.
The Raw data looks like this: https://pastebin.com/iTiaQDmi
For anyone else who might be interested and stuck. This code is to get the logged in user and the percentage discount applied to it using woocommerce dynamic pricing plugin role based discounts. There may be an easier way to do it but I haven’t found it as yet but this code worked for me.
Full code here: https://pastebin.com/wf3aZbs3