How to iterate through a nested JSON loop in PHP?

I'm new to php and I'm trying to use a loop to iterate through my JSON. I used foreach but I keep getting the errors:

Warning: Attempt to read property "areas" on array in D:\xampp\htdocs\myphpfiles\front\p.php on line 35

Warning: Attempt to read property "areas" on null in D:\xampp\htdocs\myphpfiles\front\p.php on line 37

Warning: Trying to access array offset on value of type null in D:\xampp\htdocs\myphpfiles\front\p.php on line 37

Warning: Attempt to read property "name" on null in D:\xampp\htdocs\myphpfiles\front\p.php on line 37

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in D:\xampp\htdocs\myphpfiles\front\p.php:37 Stack trace: #0 {main} thrown in D:\xampp\htdocs\myphpfiles\front\p.php on line 37

My code:

 $decoded = json_decode($response,true);
 echo '<pre>';
 print_r($decoded);
 echo '</pre>';

foreach($decoded as $item){
    $item = $item->areas;

    for ($i=0;$i<count($item->areas[$i]->name);$i++){
      echo $item->id, ',';
      echo $item->name,',';
      echo $item->post_code,',';
    }
  }

JSON array:

Array
(
    [areas] => Array
        (
            [0] => Array
                (
                    [id] => 1
                    [name] => Mohammadpur(Dhaka)
                    [post_code] => 1207
                    [district_name] => Dhaka
                )

            [1] => Array
                (
                    [id] => 2
                    [name] => Dhanmondi
                    [post_code] => 1209
                    [district_name] => Dhaka
                )

            [2] => Array
                (
                    [id] => 3
                    [name] => Gulshan
                    [post_code] => 1212
                    [district_name] => Dhaka
                )

            [3] => Array
                (
                    [id] => 5
                    [name] => Kallyanpur
                    [post_code] => 1216
                    [district_name] => Dhaka
                )

            [4] => Array
                (
                    [id] => 6
                    [name] => Shyamoli
                    [post_code] => 1207
                    [district_name] => Dhaka
                )

            [5] => Array
                (
                    [id] => 7
                    [name] => Adabor
                    [post_code] => 1207
                    [district_name] => Dhaka
                )

            [6] => Array
                (
                    [id] => 8
                    [name] => Darussalam
                    [post_code] => 1216
                    [district_name] => Dhaka
                )

            [7] => Array
                (
                    [id] => 9
                    [name] => Gabtoli
                    [post_code] => 1216
                    [district_name] => Dhaka
                )

            [8] => Array
                (
                    [id] => 10
                    [name] => Pallabi
                    [post_code] => 1216
                    [district_name] => Dhaka
                )

I used foreach to access