Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 28th, 2004, 06:53 PM
Registered User
 
Join Date: Sep 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to return array value from a function

I am totally lost here. I am writing a function that will read the data from text file and then return the array. Below is the function that I write. Can anybody help me out with the code? Thanks.

$fileName = "addresses.txt";
function MyReadFile($fileName){
        $address = fopen($fileName, "r");
        flock($address, LOCK_SH);
        while(!feof($address)){
            global $addAscv[]=fgets($address, 5096);
        }
        flock($address, LOCK_UN);
        fclose($address);
        return $addAscv[];
    }
  #2 (permalink)  
Old September 29th, 2004, 12:14 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Change return $addAscv[]; to return $addAscv;

-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once ;)


Similar Threads
Thread Thread Starter Forum Replies Last Post
return more then one array from class file Komila ASP.NET 2.0 Basics 4 June 27th, 2007 07:10 PM
How to return an array ? arulkumar ASP.NET 2.0 Professional 0 March 3rd, 2007 03:15 PM
Java to XSL // Return Array go4java XSLT 3 June 29th, 2006 06:05 PM
function return 'Nothing' problem srinuRocks ASP.NET 2.0 Basics 0 March 10th, 2005 10:32 AM
Return a UDT from a function alex_read Pro VB 6 1 April 23rd, 2004 05:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.