Home » Tag Archives:ph (page 811)

Tag Archives: ph

Get the first element of an array

November 2, 2017 Php Leave a comment

Questions: I have an array: array( 4 => 'apple', 7 => 'orange', 13 => 'plum' ) I would like to get the first element of this array. Expected result: string apple One requirement: it cannot be...

When to use self over $this?

November 2, 2017 Php Leave a comment

Questions: In PHP 5, what is the difference between using self and $this? When is each appropriate? Answers: Short Answer Use $this to refer to the current object. Use self to refer to the current cla...

Delete an element from an array

November 2, 2017 Php Leave a comment

Questions: Is there an easy way to delete an element from a PHP array, such that foreach ($array) no longer includes that element? I thought that setting it to null would do it, but apparently not. An...