define variable inside php class code example Example: declare variable in php class Click to copy<?php class SimpleClass { public $var1 = 'hello'; } ?>