Jump to content

how to empty an array??


newtoall

Recommended Posts

You can use the [http://www.php.net/unset]unset()[/url] function and then recreated it. Just recreating it works find too.

<?php
$tst = array('test','test1','test2','test3');
echo 'Before: <pre>' . print_r($tst,true) . '</pre>';
unset($tst);
$tst = array();
echo 'After: <pre>' . print_r($tst,true) . '</pre>';
?>

 

Ken

 

Link to comment
https://forums.phpfreaks.com/topic/52489-how-to-empty-an-array/#findComment-259011
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.