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

  • Home
  • SEARCH
  • 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 8802967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:13:03+00:00 2026-06-14T01:13:03+00:00

Can someone please explain why this code: $str = StackOverflow; echo $str . –

  • 0

Can someone please explain why this code:

$str = "StackOverflow"; 
echo $str . " - ";

$strCompressed = gzcompress($str);
//echo $strCompressed . " - ";

$strUncompressed = gzuncompress($strCompressed);
echo $strUncompressed . " - ";

gives the expected output of: StackOverflow - StackOverflow -

but this code (writing and reading from file):

$str = "StackOverflow";
$strCompressed = gzcompress($str);

$file = "test.cache";
$fp = fopen($file, "w");
fwrite($fp, $strCompressed);
fclose($fp);

$strCompressed = readfile($file);
echo gzuncompress($strCompressed);

does not produce the wated output of StackOverflow?

Also, I’m wondering, if I uncoment the commented line of code in the first example (//echo $strCompressed . " - ";) the script will output something like this: StackOverflow - xś.ILÎö/K-JËÉ/, so as you can see without the second StackOverflow - as with that line comented out. Any insight is appreciated.

  • 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-14T01:13:05+00:00Added an answer on June 14, 2026 at 1:13 am

    Try this:

    $strCompressed = file_get_contents($file);
    echo gzuncompress($strCompressed);
    

    readfile doesn’t return the file’s contents but outputs them

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

Sidebar

Related Questions

Can someone please explain what really goes on in this code ? If I
Can someone please explain why this code doesn't work? Both Theorem and title are
Can someone please explain this to me? I have the following code: <form action=<?php
Can someone please explain why this code is not outputting a value for $consultant
Can someone please explain why this JavaScript code outputs zero instead of one? Also,
Can someone please explain in plain language how this code works to give a
this is absolutely driving me crazy! Can someone please explain why this code isn't
Can someone please explain this piece of code which I have tried to decipher?
Can someone please explain this bit of piece of code? Thanks. alert({foo:test foo, bar:test
Can someone please explain what does this code do? def stemmer(word): [(stem,end)] = re.findall('^(.*ss|.*?)(s)?$',word)

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.