Jump to content

variable change from class


purencool

Recommended Posts

I have a method that is returning a funny variable, it should be returning what is below and when I echo the return from inside the method it is right.

Software/Section

 

but when I goto echo the from outside the class I get the following. It adds a back slash

Software//Section

 

 

this is the method code and it works fine when I echo the returnValue the value is right

    // Creates a  dymamic case statement for making a the choice
    // inside and array
        foreach (scandir($dir) as $folderItem) {
            if ($folderItem != "." AND $folderItem != "..") {
                if (is_dir($dir.$folderItem.DIRECTORY_SEPARATOR)) {

                    $folderItem = $folderItem  ; // this allows the the dir to be placed if statements below
                    $folderContents = $this->showPage( $dir.$folderItem ,$getPageGlobal  , $subdir);
                    $subdir = ""; // this resets so that ithe value does not get added to main links;
                }
                else {
                // put into if into array
                    if($getPageGlobal== $folderItem) {
                        $pageReturn = $dir . $folderItem;
                        
                    }
                }
            }
        }
        echo $pageReturn.'<br>';
        return $pageReturn;

 

This is the way I am echoing the class. This is when it decides to add the back slash

echo $dynamicMenu->getShowPage();

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.