I have a script which can be used multiple times per script, each instance of the script requires some php stuff to be done, I need to create a unique name for each instance variable e.g.
I need:
$typedbefore1 = get_post_meta( $text, '_cmb2_typed_text', true );
$typed1 = '"' . implode('","', $typedbefore1) . '"';
$typedbefore2 = get_post_meta( $text, '_cmb2_typed_text', true );
$typed2 = '"' . implode('","', $typedbefore2) . '"';
$typedbefore3 = get_post_meta( $text, '_cmb2_typed_text', true );
$typed3 = '"' . implode('","', $typedbefore3) . '"';
The variable $text is a number generated by the user so I can use that e.g.
$typedbefore.$text = get_post_meta( $text, '_cmb2_typed_text', true );
$typed.$text = '"' . implode('","', $typedbefore.$text) . '"';
That doesn't work (obviously), is there a way to do what I need?
Converted to arrays but my implode isn't working:
$typedbefore = array();
$typedbefore[$text] = get_post_meta( $text, '_cmb2_typed_text', true );
$typed = array();
$typed[$text] = '"' . implode('","', $typedbefore[$text]) . '"';
It's still storing the $typed as an array, how can I do the second part so it implodes the data from $typedbefore?