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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:04:07+00:00 2026-06-12T15:04:07+00:00

Hey all i am wondering why my code below is only writing the first

  • 0

Hey all i am wondering why my code below is only writing the first but does not write the second file

$counterFile = 'counter.log';
$counterFileBU = 'counterBU.log';

if(!is_writable($counterFile)) {
    $count = 'WErr';
}
else {
    $count = file_get_contents($counterFile);
    $count++;
    file_put_contents($counterFile, $count);
    file_put_contents($counterFileBU, $count . ' @ ' . date("F j, Y, g:i a"));
}

Any help would be great!

  • 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-12T15:04:09+00:00Added an answer on June 12, 2026 at 3:04 pm

    Your code would not run and would not output anything if this condition is not meet ?

     if(!is_writable($counterFile)) {
    

    You should try trigger some error

    $counterFile = __DIR__ . '/counter.log';
    $counterFileBU = __DIR__ . '/counterBU.log';
    
    touch($counterFile);
    touch($counterFileBU);
    
    if(!is_writable($counterFile) || !is_writable($counterFileBU) ) {
       throw new Exception("Not Writable");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all. Here is the scenario. I have the below code, and I'm needing
Hey all. I'm wondering how to implement a timeout event in the System.Windows.Forms.Webbrowser control?
Hey all, I am wondering what the best way to do the following is:
Hey all, I'm just wondering if it is possible to get the name of
Hey all i am in need of some help getting my code working correctly
Hey all. Is there a way to copy only a portion of a single
Hey all, i'm just wondering if there was any way to condense this line
hey all, I'm new to Java and was wondering if I define a method
Hey guys I was wondering how I could download a file that is generated
Hey all, I'm wondering if anyone has ever used a tool which will take

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.