Jump to content
Sign in to follow this  

Can my Function create & return an array?

Recommended Posts


Can I write a function which creates and returns an array, without the array going out of scope when the function returns? It would look something like this:

Func GetDBRecord(ByRef $con)

Local $rec[3]

Local $rs = ObjCreate("ADODB.Recordset")

$rs.Open("select * from table", $conn)


$rec[0] = $rs.Fields(0).Value

$rec[1] = $rs.Fields(1).Value

$rec[2] = $rs.Fields(2).Value

Return $rec


$myrec = GetDBRecord($con)

Would $myrec be valid and still in scope?


Share this post

Link to post
Share on other sites

Yes it would.

[sub]Quantum mechanics: The dreams stuff is made of[/sub]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.