I'm sorry that you've had a bad experience. At this point, the community is extremely divided on whether or not it is acceptable for edits to touch the code in other people's answers. Some of us feel that such is the whole point of collaborative editing: to fix mistakes and make good answers even better. Others take the stance that it is their answer and they are solely responsible for its contents, mistakes or not.
There was a previous discussion here, centered on a specific edit that another person submitted and had rejected for a similar reason. And there is a more general discussion about this problem here that aims at establishing a consensus and then educating users about the community standards. Please feel free to jump in on either of those discussions (or others that you find linked therein) if you have a strong opinion or any ideas/suggestions to contribute.
As far as removing the suggested edits feature because the community is divided on one of its uses, well don't you think that's a little bit radical? Even if those of us who think it's OK to fix code in answers lose the debate, there will still be a purpose in suggesting edits. There are lot of other problems you can fix in a post aside from the code. Spelling and grammar mistakes are a fact of life, and especially on an international site like Stack Overflow, where English is not the first language of many members. Additionally, edits are always encouraged that clean up formatting—that makes the post easier to read and is therefore a net improvement all the way around. There is no division in the community about these types of edits, so if you're feeling frustrated with having your edits rejected, you could focus on fixing these issues for a while.
It should come as little surprise to the regulars here that I would have likely approved both of those edits. Well, I'm not sure about this one because I don't know anything about PHP and are not qualified to evaluate its veracity. But I definitely would have approved the other one.
You mention being frustrated that the reviewers of your edit didn't check the comments on the answer to see that your edit was appropriate. While it would be nice if everyone did that, the reviewing queue doesn't exactly make it easy to see things in context. You have to click on a fairly obscure link to open the question in a new tab before you can read the comments. That's asking a lot of reviewers; some of us are willing, others are not. You can, however, make it easier on everyone by including that type of information in your edit summary. If you want reviewers to check the comments for confirmation of the validity of your edit, at least ask them explicitly to do so. I've seen that done before, and it's worked out.
Another minor quibble with this edit: you are strongly discouraged from working around the 6-character minimum by adding nonsense to the post. I understand why you think that the syntax needed to be fixed, but the right way to do it would have been to add some explanation to the answer. For example, what the code does and how it works. That's what differentiates a good answer from a code dump.