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 8536885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:46:11+00:00 2026-06-11T10:46:11+00:00

So I made this file editor assignment for school and my teacher is well

  • 0

So I made this file editor assignment for school and my teacher is well satisfied with the results. Yet he has one thing that he wants me to change:

At the moment I’m reading every file in a directory but im checking for each extension if I want to make it editable. That means I have to add an extension in the if statement each time a new extension needs to be added.

My teacher told me theres a function that returns true if the file is a text file like .html, .css, .php etc. and if its a .exe, .gif etc. it will return false. He’s too lazy to give me the name of the function.

So.. What’s the name of it? I’ve been trying to look it up but I just can’t find the name of the function..

Edit:

fine lol hes not lazy

  • 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-06-11T10:46:12+00:00Added an answer on June 11, 2026 at 10:46 am

    Quote:

    Try the finfo_file() function.

    Here’s a blog describing its usage: Smart File Type Detection Using PHP

    Taken from:
    How can I tell if a file is text using PHP?

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

Sidebar

Related Questions

I have a doubt, I made this build file in order to build 3
I am trying to read this file I created as sample made up from
I made a key file like this: C:\Users\Alex>keytool -genkey -v -keystore alexkey.keystore -alias alexkey
I made a list from a CSV file. It looks like this: ['18', '29',
I made this bash one-liner which I use to list Weblogic instances running along
I made this loader which actually works pretty well. I now want to make
I have a text editor I made, which has been working perfectly for the
http://lakers.sonikastudios.com/gallery/sample-gallery-post-1/ That post has several pages using the quicktag of Wordpress. This post is
Made this nice little loop for hiding and showing div's, works as a charm
I made this function to verify a user's twitter credentials. Its running on two

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.