Home >Backend Development >PHP Problem >How to discard key in php
To delete the element of the specified key in the array, you can use unset directly:
Related recommendations: "php Basic Tutorial"
<?php $arr = array('a','b','c','d'); unset($arr[1]); print_r($arr); ?>
The result is Array ([0] => a [2] => c [3] => d )
The above is the detailed content of How to discard key in php. For more information, please follow other related articles on the PHP Chinese website!