You're looking for var_export:
var_export(true, true) : string = "true"
If you have an integer value, you can use type juggling beforehand:
var_export((bool) 1, true)
: string = "true"
var_export((bool) 0, true)
: string = "false"
Please see the chapter on type juggling http://php.net/manual/en/language.types.type-juggling.php before you attempt to run this with the Strings "On" and "Off" - the first one will evaluate to true, the latter one to - guess! (I'll help, it's true as well). So beware. An empty string however would be casted to false.