---
title: "Tömma array"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/98498-tömma-array"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "Web-Tor"
published: "2004-03-01T08:40:48.000Z"
updated: "2004-03-01T08:50:44.000Z"
replies: 2
views: 443
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/98498-tömma-array"
---

# Tömma array

## #1 — Web-Tor, 2004-03-01T08:40Z

Finns det något sätt att nollställa en array?
Jag vill alltså tömma den helt på värden.

```php
<?php
$arr[0]='A';
$arr[1]='B';
$arr[2]='C';

echo 'a0: '.$arr[0].'<br>';
echo 'a1: '.$arr[1].'<br>';
echo 'a2: '.$arr[2].'<br>-------------<br>';

/* Här vill jag nollställa min array... */

$arr[0]='1';
$arr[1]='2';

echo 'a0: '.$arr[0].'<br>';
echo 'a1: '.$arr[1].'<br>';
echo 'a2: '.$arr[2].'<br>'; /* ...så att den inte skriver ut 'C' här */
?>
```

Permalänk: https://www.webforum.nu/p/98498

## #2 — Gein, 2004-03-01T08:44Z

[unset($arr);](http://se.php.net/manual/sv/function.unset.php)

Permalänk: https://www.webforum.nu/p/1287828

## #3 — Web-Tor, 2004-03-01T08:50Z

Tack! :r

Permalänk: https://www.webforum.nu/p/1287831

---

Tråden på webben: https://www.webforum.nu/amne/php/98498-tömma-array
