# Updating Array values with foreach?

**URL:** <https://forum.kirupa.com/t/updating-array-values-with-foreach/238169>\
**Category:** Uncategorized\
**Created:** [September 7, 2007, 8:23pm UTC](https://forum.kirupa.com/t/updating-array-values-with-foreach/238169 "2007-09-07T20:23:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![WearDark](https://avatars.discourse-cdn.com/v4/letter/w/48db29/32.png) [@WearDark](https://forum.kirupa.com/u/WearDark)\
**Post date:** [September 7, 2007, 8:23pm UTC](https://forum.kirupa.com/t/updating-array-values-with-foreach/238169/1 "2007-09-07T20:23:22Z")

</div>

In the following loop:

```auto

foreach($gig_array as $value){
            echo $_POST['gig_info']. ".";
            echo $_POST['ticket_info']. ".";
            if($value->title == $selected){
                echo "VALUE FOUND
";
                $value->blurb = $_POST['gig_info'];
                $value->tickets = $_POST['ticket_info'];
            }
            
        }

```

I cannot seem to get the $value to maintain the change once the loop has completed. Maybe im misunderstanding the the foreach loop in itself but doesn’t $value represent an array entry and therefore shouldn’t changes made to the $value var propogate to the array??

Any ideas?

Cheers.
