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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:38:24+00:00 2026-06-15T23:38:24+00:00

As per discussion How to check if a string can be used as a

  • 0

As per discussion How to check if a string can be used as a variable name in PHP? the user TIM is giving there a good answer but still not solving my problem.

I am doing the call exactly like that, but on production server they have magic quotes gpc active! and.. of course.. i can’t disable it, i can’t ask to disable and last but not least, i can’t disable it during runtime (as per manual).
So in this case, even if using

echo $xml->example->{'phone-number-1'};

php is trying to execute a mathematical operation between that stuff and i am really becoming mad to understand how to access to that “node” in this case.

And of course, if i test this with magic quotes OFF, everything is ok as per manual.

Thank you in advance

  • 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-15T23:38:25+00:00Added an answer on June 15, 2026 at 11:38 pm

    To elaborate on the comment made, with the information available that you want to share, your code works as advertised, regardless of whether magic_quotes_gpc is set or not. It will not attempt to perform any arithmetic on the strings, and magic_quotes_gpc will not affect the way simplexml parses it’s data.

    ~/temp  ►  cat foo.xml
    <example>
        <node-ex>
           <identifier-1>ValueOfIdentifier1</identifier-1>
           <phone-number-1>141 555 1414</phone-number-1>
        </node-ex>
    </example>
    
    ~/temp  ►  cat test.php
    <?php
    $root = simplexml_load_file("foo.xml");
    
    echo $root->{'node-ex'}->{'identifier-1'} . "\n";
    echo $root->{'node-ex'}->{'phone-number-1'} . "\n";
    
    ~/temp  ►  php test.php              
    ValueOfIdentifier1
    141 555 1414
    ~/temp  ►  php -dmagic_quotes_gpc=1 test.php
    ValueOfIdentifier1
    141 555 1414
    

    Of course, if your example isn’t the same as the data you’re actually using, that might be the issue. If magic_quotes_gpc is enabled, using stripslashes() should reverse it, and then it should work. If you’re not using a constant string, but a variable — that might be the cause of the issue. There is however nothing in your example that indicates anything that should be affected by either magic_quotes_gpc or using “-” in the property name.

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

Sidebar

Related Questions

I would like to start a community discussion. As per my question, when do
Per a great answer from another question I have begun mounting global resources (css/js/images)
Per the documentation , String.Format will throw a FormatException if either (A) the format
There has been some discussion of the merits or demerits / evilness of using
So, per Mehrdad's answer to a related question , I get it that a
per the discussion of R programming styles, I saw someone once said he puts
Is there a mechanism to have a conditional variable use multiple mutexes? I am
Per the answer here: Upload images/video to google cloud storage using Google App Engine
As per @Potatoswatter's suggestion, I have created a new discussion. Reference is this response
The accepted answer to this question , and a similar discussion at work today

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.