PHP uses the unset function to turn the array into an object

unset (mixed $var [, mixed ...]): voidunset () Destroy the specified variable. The behavior of unset () in the function will vary depending on the type of the variable you want to destroy. If you unset () a global variable in the function, only the local variable will be destroyed, and the variable in the calling environment will keep the same value before calling unset (). Because the index is not reset, ...]): void unset() destroys the specified variable. The behavior of unset() in the function will vary depending on the type of variable you want to destroy. If you unset() a global variable in the function, only the local variable will be destroyed, and the variable in the calling environment will keep the same value before calling unset(). Because the subscript is not reset,...]):V O I D U n- S E T ( ) pin destruction means specified in variable amounts . U n- S E T ( ) in the function number in the row is will depend depend on the want to pin destroy the variable amount of class type and there are not the same . As if the function number in U n-S E T ( ) a th full Board variable amount , it is only a bureau portion variable amount is a pin destroyed , and the adjustment with ring environment in a variable amount of the guarantee hold tone with U n- S E T ( ) of the former one kind of Value . Because of the subscript not have re- set theThe original reason , arr will become a target by using array_values () function, so that only the return value of the array, the keys are not returned.
array_values($arrr)
Tip: After using unset(), you must use array_values() to reorganize the array! ! !

Guess you like

Origin blog.csdn.net/weixin_43784997/article/details/115235515