Title: Illegal string offset &#039;id&#039;
Last modified: August 31, 2016

---

# Illegal string offset 'id'

 *  [angelatjuh](https://wordpress.org/support/users/angelatjuh/)
 * (@angelatjuh)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/illegal-string-offset-id/)
 * Hello,
 * What does ‘ Warning: Illegal string offset ‘id’ in X on line 4 mean?
    The line
   4 includes:
 *     ```
       <?php
       global $options;
       foreach ($options as $value) {
           if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
       }
       ```
   
 * What is wrong with this code?
    Website is [http://www.vlaslant.nl](http://www.vlaslant.nl)
 * Hope someone can help!
 * Kind regards,
    Angela

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

 *  [jdmrgtnj](https://wordpress.org/support/users/jdmrgtnj/)
 * (@jdmrgtnj)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/illegal-string-offset-id/#post-7205637)
 * `$$value['id'] = $value['std']; } else { $$value['id']` has one too many ‘$’s
 * $$value should be $value
 * other then that,,looks ok
 *  Thread Starter [angelatjuh](https://wordpress.org/support/users/angelatjuh/)
 * (@angelatjuh)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/illegal-string-offset-id/#post-7205702)
 * Thanks,
 * Changed it to one $ but still the same error.
    I did change it in both $$values,
   did you mean that?
 * So I tried:
    <?php global $options; foreach ($options as $value) { if (get_settings(
   $value[‘id’] ) === FALSE) { $value[‘id’] = $value[‘std’]; } else { $value[‘id’]
   = get_settings( $value[‘id’] ); } }
 * instead of
 * <?php
    global $options; foreach ($options as $value) { if (get_settings( $value[‘
   id’] ) === FALSE) { $$value[‘id’] = $value[‘std’]; } else { $$value[‘id’] = get_settings(
   $value[‘id’] ); } }
 *  [Marvel Labs](https://wordpress.org/support/users/royalprince/)
 * (@royalprince)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/illegal-string-offset-id/#post-7205710)
 * The “Illegal string offset” warning when using $value[‘id’] means that the function
   is being passed a string instead of an array. (And then since a string offset
   is a number, ‘id’ is not suitable.)
 * So in theory the problem lies elsewhere, with the caller of the code not providing
   a correct parameter.
 * You might want to debug why the function is being given a string by examining
   the calling code, and find out what value it has by doing a var_dump($inputs);
   in the function. But for the quick solution you could change the line to:
 * if (is_array($value) && get_settings( $value[‘id’] === FALSE) {
 * Do it where the $value[‘id’] is, as this is a problem with php5.4, you could 
   just revert back to 5.3 and it would be fine.

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

The topic ‘Illegal string offset 'id'’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [Marvel Labs](https://wordpress.org/support/users/royalprince/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/illegal-string-offset-id/#post-7205710)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
