Title: How to Split string with Dash?
Last modified: February 14, 2023

---

# How to Split string with Dash?

 *  Resolved [USREC](https://wordpress.org/support/users/hawaiirealestate/)
 * (@hawaiirealestate)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/how-to-split-string-with-dash/)
 * Have Numbers field like 1-2-3-4
   Would like to create new hidden Fields ie. Field1,
   Field2, Filed3, Field4 each containing data
 * Field1=1
   Field2=2Field3=3Field4=4

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Phil Kurth](https://wordpress.org/support/users/philkurth/)
 * (@philkurth)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/how-to-split-string-with-dash/#post-16515780)
 * Hi [@hawaiirealestate](https://wordpress.org/support/users/hawaiirealestate/),
 * Thanks for reaching out and sorry to have kept you waiting. It sounds like you
   want to take the value of one field and split it across four different hidden
   fields — is that right?
 * This kind of functionality is outside the scope of the ACF Theme Code plugin 
   but if I were doing something like this, I’d explore the use of ACF’s [acf/update_value filter](https://www.advancedcustomfields.com/resources/acf-update_value/)
   to intercept the value before it is saved to the database and handle it accordingly.
 * Hope that helps. If you need more guidance on this one, the best place to ask
   would be the ACF support forums.
 * Cheers,
   Phil
 *  Thread Starter [USREC](https://wordpress.org/support/users/hawaiirealestate/)
 * (@hawaiirealestate)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/how-to-split-string-with-dash/#post-16515800)
 * Instructions not clear
 *  Plugin Author [Phil Kurth](https://wordpress.org/support/users/philkurth/)
 * (@philkurth)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/how-to-split-string-with-dash/#post-16519673)
 * [@hawaiirealestate](https://wordpress.org/support/users/hawaiirealestate/), it
   seems we’re not understanding each other. Perhaps you are asking how to render
   hidden HTML input fields using the output of ACF Theme Code. If that’s the case,
   here are some resources that you might find useful:
 * PHP’s [explode() function](https://www.php.net/manual/en/function.explode.php)
   can be used to split a string into an array at a specified character. In your
   case, the character will be ‘-‘.
 * Given you’ll now have an array of values, you can loop through them using a PHP`
   for` or `foreach` loop. [Learn more about loops in PHP here](https://www.w3schools.com/php/php_looping_for.asp).
 * Given ACF Theme Code provides boilerplate code for use in a template, you are
   free to add any code you need to render your fields to suit your application.
   If you need to render hidden fields, you could echo the markup needed within 
   your PHP loop. If you are unsure of how to write hidden HTML fields, you can 
   [learn about the required markup here](https://www.w3schools.com/tags/att_input_type_hidden.asp).
 * If you don’t feel confident to implement these concepts, I suggest sourcing a
   developer to help you.
 * Cheers,
   Phil

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘How to Split string with Dash?’ is closed to new replies.

 * ![](https://ps.w.org/acf-theme-code/assets/icon-256x256.png?rev=1458037)
 * [ACF Theme Code for Advanced Custom Fields](https://wordpress.org/plugins/acf-theme-code/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/acf-theme-code/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/acf-theme-code/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-theme-code/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-theme-code/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-theme-code/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Phil Kurth](https://wordpress.org/support/users/philkurth/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/how-to-split-string-with-dash/#post-16519673)
 * Status: resolved