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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:39:19+00:00 2026-06-10T11:39:19+00:00

During development when other people are experimenting with my site and have issues, I

  • 0

During development when other people are experimenting with my site and have issues, I want to be able to find out where my code was having issues, get_defined_vars() is probably the most useful thing for me in finding out what happened at this point.

I am up to the point of writing this function, however it is returning:

Parse error: syntax error, unexpected ‘=’

Does anybody know a way to send yourself get_defined_vars() from php?

if(isset($_GET['sendmeanemail'])){
$emailarr = get_defined_vars();
$to      = 'myemail@gmail.com';
$subject = 'Debug Report for'. $currentApiUser['first-name']. ' '. $currentApiUser['last-name'];
$message = '<pre>\n';

$message. = print_r(addslashes($emailarr));
$message. = '</pre>';
$headers = 'From: webmaster@domain.com' . "\r\n" .
    'Reply-To: webmaster@domain.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

    mail($to, $subject, $message, $headers);
}

Edit: This was fixed by changing to: (pre tags arent actually necessary, am figuring out how to better format for gmail)

if(isset($_GET['sendmeanemail'])){
$emailarr = get_defined_vars();
$to      = 'myemail@gmail.com';
$subject = 'Debug Report for'. $currentApiUser['first-name']. ' '. $currentApiUser['last-name'];
$message = '<pre>';

$message .= print_r($emailarr, true);
$message .= '</pre>';
$headers = 'From: webmaster@domain.com' . "\r\n" .
    'Reply-To: webmaster@domain.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

    mail($to, $subject, $message, $headers);
}
  • 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-10T11:39:21+00:00Added an answer on June 10, 2026 at 11:39 am

    You need to call print_r with the second parameter set to true. Also, addslashes should not be called on an array. It should look like:

    print_r($emailarr,true);
    

    Last, you need to move the . (period) next to the equal sign. Your code should look like:

    $message = '<pre>\n';
    $message .= print_r($emailarr,true);
    $message .= '</pre>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

it's common to see something like this in code, hopefully only during development: //XXX:
During a development project, the delivered code can go between different stages different environment
I have several environments that my SSIS packages move through during a development cycle
We have been using sql server 2005 during development and have had no real
I have an action that when I was working on during development was called
During development, I want to create run configurations for several activities within my App,
I use WebMatrix for deployment of files and databases during development. I want to
Encoding issues are among the one topic that have bitten me most often during
We are using Grails [Spring+Hibernate] and have one service method with @Transactional(readOnly=true). During development
During development, I use this to load the latest jQuery: <script src=http://www.google.com/jsapi></script> <script type=text/javascript>

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.