Title: PHP Constants cause errors
Last modified: October 26, 2020

---

# PHP Constants cause errors

 *  Resolved [Rob W](https://wordpress.org/support/users/robertark/)
 * (@robertark)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/php-constants-cause-errors/)
 * When using PHP functions that use PHP constants in the function, WP All Import
   throws an error.
 * For example, this error: “Unexpected token TEXT” comes from when using:
    `[str_pad({
   location_zip[1]}, 5, "0", STR_PAD_LEFT)]`
 * But if I change the constant to the integer value, it works fine. Eg:
    `[str_pad({
   location_zip[1]}, 5, "0", 0)]`

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

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/php-constants-cause-errors/#post-13593396)
 * Hey [@robertark](https://wordpress.org/support/users/robertark/),
 * > When using PHP functions that use PHP constants in the function, WP All Import
   > throws an error.
 * Unfortunately, that’s normal behavior due to how we parse PHP functions. You’ll
   have to write a custom function that uses the constant, then call that function
   instead. For example:
 * `[my_custom_function({location_zip[1]})]`
 * Code:
 *     ```
       function my_custom_function( $zip ) {
            return str_pad( $zip, 5, "0", STR_PAD_LEFT );
       }
       ```
   
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/php-constants-cause-errors/#post-13617867)
 * Hi [@robertark](https://wordpress.org/support/users/robertark/),
 * I’m marking this as resolved since it’s been a while, but please let us know 
   if you still have questions about this.
 * Anyone else with questions, please open a new topic.

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

The topic ‘PHP Constants cause errors’ is closed to new replies.

 * ![](https://ps.w.org/wp-all-import/assets/icon-256x256.png?rev=2570179)
 * [WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets](https://wordpress.org/plugins/wp-all-import/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-all-import/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-all-import/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-all-import/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-all-import/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-all-import/reviews/)

## Tags

 * [constant](https://wordpress.org/support/topic-tag/constant/)
 * [php function](https://wordpress.org/support/topic-tag/php-function/)

 * 2 replies
 * 2 participants
 * Last reply from: [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/php-constants-cause-errors/#post-13617867)
 * Status: resolved