Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3457574
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:52:37+00:00 2026-05-18T09:52:37+00:00

I am not very used to php, but I have made an index.php page

  • 0

I am not very used to php, but I have made an index.php page to put in any folder of my private web server, in order to allow me to quickly download some docs. It works fine, except that I tried to add the file size. That part of the code just displays “filesize” instead of the size itself. Can someone help to fix this?

<h1>My tools</h1>
<?php
$dirname = ".";
$dir = opendir($dirname);

while(false != ($file = readdir($dir)))
    {
    if(($file != ".") and ($file != "..")  and ($file != "index.php"))
        {
        echo("<a href='$file'>$file</a> filesize($file) <br />");
        }
    }
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T09:52:37+00:00Added an answer on May 18, 2026 at 9:52 am
    echo("<a href='$file'>$file</a> ".filesize($file)." <br />");
    

    You can’t embed anything like that. In your case PHP has no way of knowing if you want to call the filesize function or you just want that text printed out so it was built to interpret your format as text instead of a function call, that being the safe option.

    See here for what you are allowed to put inside double quoted strings: http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched around but I am not very experienced with PHP. The script
I'm not very used to programming with flags, but I think I just found
I've used BigDecimals before but not very often and I was working on something
I have not used jquery much yet and not very familiar with it. Trying
I'm very new to Android . I've used Java before but not for around
I have used AJAX to successfully change the content of a web page. I
How should Java's drawImage() be used? I do not find the JDK documentation very
Not very strong in PHP so here is my question: I am building a
Hi I'm not very good at explaining this in the right terms but I'm
I am not very much expert in gdb and mdb but What i know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.