Re: Function Parameter converted from string to array when passed

From: Date: Tue, 06 Nov 2001 00:01:20 +0000
Subject: Re: Function Parameter converted from string to array when passed
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-73526@lists.php.net to get a copy of this message
On Tue, 6 Nov 2001 09:58, Michael Motal wrote: > Ok, I've tried finding the answer online but have had no luck. I have > a main page with this snippet of code: > > <?php > $current_page = substr($PHP_SELF,5); > echo("BEGIN MAIN Current Page: " . $current_page . "<BR>"); > require_once("./library/gui_coding.php"); > $filename = "./includes/top_banner.html"; > $top_banner = (fread(@fopen($filename, "r"),filesize($filename))); > $menu_html = create_menu($current_page); # strip off the leading > /dev/ of the page name > ... > > which calls the create_menu function with a STRING parameter > $current_page. However, when the function gets it, it is suddenly an > ARRAY. A sample of the output: > > BEGIN MAIN Current Page: main.html > BEGIN create_menu with current_page=Array > Begin getItemMenuLevel with site= stryxus current_item= Array > ... > > I've tried settype() and cast and in both instances it still was > interpreted by the called function as an array. > > How can I force the parameter to be passed as a STRING instead of being > converted to an ARRAY? > > -Michael It seems that $current_page is a string at line 2, but by line 7 it becomes an array. I would wonder whether there were something in the included file that might affect the variable. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA If wishes were horses, dogfood would be a lot cheaper.

« previous php.general (#73526) next »