Skip to content

How to print all properties of an object

I have an unknown object in php page. How can I print/echo it, so I can see what properties/values do it have? What about functions? Is there any way to know what functions an object have? Answer or These are the same things you use for arrays too. These will show protected and private properties of objects w…

MySQL select column length in php (below PHP7)

How do I get the actual max length of a specified column in php (prior to PHP7)? For instance, this table: id – int(11) name – string(20) I want in php to select the maximum number of characters that a field can have, like and it should then return 20 (since it’s the maximum number of charac…

Remove all attributes from html tags

I have this html code: How can I remove attributes from all tags? I’d like it to look like this: Answer Adapted from my answer on a similar question The RegExp broken down: Add some quoting, and use the replacement text <$1$2> it should strip any text after the tagname until the end of tag /> o…

PHP Linefeeds (n) Not Working

For some reason I can’t use n to create a linefeed when outputting to a file with PHP. It just writes “n” to the file. I’ve tried using “\n” as well, where it just writes “n” (as expected). But I can’t for the life of me figure out why adding n to my strin…