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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:28:18+00:00 2026-06-07T21:28:18+00:00

i have a small function to write contents function write($data) { file_put_contents(filename.txt,$data,FILE_APPEND); } it

  • 0

i have a small function to write contents

function write($data)
{
  file_put_contents("filename.txt",$data,FILE_APPEND);
}

it works good except some where when i do the following

write( var_dump($someObject) );

this gives an error message of

illegal character.

I see the this error message through an alert box in browser the php gets call through an ajax call. Any help in debugging this would be appreciated thanks.

  • 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-07T21:28:21+00:00Added an answer on June 7, 2026 at 9:28 pm

    var_dump will not work like that because it outputs directly instead of returning the output. If you want to capture the output in order to write it somewhere else you have to use output buffering:

    ob_start();
    var_dump($data);
    write(ob_get_clean());
    

    Alternatively, var_export is also something that would work as long as you remember to pass in true for the second parameter:

    write(var_export($data, true));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script here, and it works amazing, except for one small detail.
I have made a small function which should print some InfoPath files. It is
i have small function that running on condintion, if text box value is not
In an access database I have a small function that is called on startup
I have a small javascript function which opens an url in a new tab:
i have build a small function whose work to get value in alert box
I have a small C# function that takes any generic SQLDataReader and converts it
I have a small sample function: #define VALUE 0 int test(unsigned char x) {
I have written a small function, which uses ElementTree to parse xml file,but it
Hi I am learning JQuery and I have written a small function where I

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.