Jump to content

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?


Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...