elements from functions that return arrays
From: M. Katz (MKatz843_at_onebox.com)
Date: 01/31/04
- Next message: M. Katz: "elements from functions that return arrays"
- Previous message: Rahul Anand: "Re: A very annoying require() -and include()- problem."
- Next in thread: CountScubula: "Re: elements from functions that return arrays"
- Reply: CountScubula: "Re: elements from functions that return arrays"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Jan 2004 01:01:13 -0800
I'd like to access a single element from a function that returns an
array; and I'd like to do it in a single statement.
Here's an example. This is obvious.
$a = explode(".", "this.is.some.text");
$b = $a[2];
So how can I do that in a single statement?
$a = explode(".", "this.is.some.text")[2] // no
$a = (explode(".", "this.is.some.text"))[2] // nope
$a = [explode(".", "this.is.some.text")][2] // no way
How close am I coming to the final result. My goal is to be able to
nest them.
I was looking for an answer in the array functions, but the ones I
found don't return a scalar value, they return arrays in my cases.
Thanks,
M. Katz
- Next message: M. Katz: "elements from functions that return arrays"
- Previous message: Rahul Anand: "Re: A very annoying require() -and include()- problem."
- Next in thread: CountScubula: "Re: elements from functions that return arrays"
- Reply: CountScubula: "Re: elements from functions that return arrays"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|