14

A whole load of questions is about manipulations. These questions normally include more or less convoluted examples of inputs and outputs. While other languages' users usually provide raw copy-pastable snippets or jsons, most php folks prefer to post debugger dumps which are not suitable for testing and experimenting with. Recent examples:

So when you answer such a question, you either have to post your solution untested or do a tedious job of converting these debugger dumps back to source code.

My questions to people who answer php questions:

  • do you have a problem with that, and how do you deal with it?
  • do you think it would help if we add a red popup to the ask page saying that it's better to post example data in a testable form?

(If you're going to make a php joke, I'd love to hear it).

9
  • 6
    You could just close-vote questions lacking testable data with that "why isn't this code working?" close reason under off-topic.
    – Cerbrus
    Oct 29, 2014 at 8:47
  • @Cerbrus: that would be logical, but hardly practical, because the vast majority of questions are this way.
    – georg
    Oct 29, 2014 at 8:56
  • 11
    Did you hear about that brainfuck compiler written in PHP? Why would they put a joke language that people use to troll other developers, and Brainfuck together into the same project?
    – user247702
    Oct 29, 2014 at 9:09
  • 2
    Isn't there a canonical question/answer pair that can be used as duplicate target for all those questions as I explained here?
    – rene
    Oct 29, 2014 at 9:10
  • I can assure you this problem is not unique to PHP... :\ Oct 29, 2014 at 11:56
  • 2
    @Qantas94Heavy: from my experience, javascripters sometimes posts console logs (or even screenshots. go figure), but magnitudes rarer than php folks. The problem with php is that most questions contain data you can't just copy-paste and play with.
    – georg
    Oct 29, 2014 at 12:23
  • yeah sometimes when i deal with this, (especially the ones with the heavy nested structure from a print_r()) i just politely ask for a var_export() if possible, if the OP indeed did make some attempt of solving the problem, if its just straight up dump print_r(), i just vote to close
    – Kevin
    Oct 30, 2014 at 11:06
  • 1
    The problem with PHP is that you get very little feedback from the errors it throws, so people post a lot more "Syntax error" style questions. Perhaps the solution is to demand PHP improve this? :p
    – Jon Story
    Oct 30, 2014 at 15:25
  • I am struggling with this one as well. I have seen some attempts at writing a "reverse print_r", but they work 1/5 times. I have seen some "reverse var_dump" code, it is a bit better, but few OP ask questions with that. I now ignore many array question just because of that...
    – Nic3500
    Nov 15, 2017 at 2:15

0

You must log in to answer this question.

Browse other questions tagged .