I
I
Ilya2014-11-25 16:36:15
CodeIgniter
Ilya, 2014-11-25 16:36:15

How to remove part of an array?

How to remove an array value with a specific key if it is an array of objects?
Thank you in advance.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander Aksentiev, 2014-11-25
@Sanasol

unset()

G
Gosha Mann, 2014-11-25
@IgorMann

so you have an object, not an array unset($user->response[0]->hash)

F
FanatPHP, 2014-11-25
@FanatPHP

<?php
$a[] = new stdClass();
echo count($a);
unset($a[0]);
echo count($a);

- everything is working.
If some of your own code does not work for you, then deal with this code, deleting from the array has nothing to do with it.

O
olekhy, 2014-11-27
@olekhy

Value or array element? Unclear.
If the value is then NULL can be assigned. If the element is unset.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question