Re: how a function 'return' statement works

From: Date: Wed, 13 Feb 2002 22:18:32 +0000
Subject: Re: how a function 'return' statement works
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-84672@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 13 February 2002 22:55, Erik Price wrote: > Can anyone give my puny mind an explanation as to why the following > function only returns the value "Array" ? > > # =============================================================== > # get_current_page_name() > # --------------------------------------------------------------- > # Returns the current document > # Arguments > # ----------- > # no arguments > # =============================================================== > > function get_current_page_name() > { > $current_page_name = explode("/", $_SERVER['PHP_SELF']); > $current_page_name = array_slice($current_page_name, -1); > return $current_page_name; > } > from the manual: array array_slice ( array array, int offset [, int length]) array in, array out.. it wouldn't suprice me if when you changed the return into return $current_page_name.''; it would become a string again. Gerhard -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8auY+Um/iHoGGwKMRAqaDAJ4v4zT+l4qvJN+Rei1zx7fdxrWV4wCgoly2 BoZqmifb7o6kaO6RzrZp0NU= =NjIn -----END PGP SIGNATURE-----

« previous php.general (#84672) next »