As far as I'm aware, that's not allowed by either language.
They both allow it for single-statement if()s and loops, but not for functions (and in the case of PHP, not for classes either).
But even if it was allowed, I'd strongly recommend against it; the braces are there for a reason, to aid readability and avoid ambiguity. I'd recommend always using them for if()s and loops for the same reason, even though they're not strictly required there.
Languages like Python get away without braces because they have very strict indentation rules. Without those rules, a language need braces (or some other block marker); if you don't use them, you run a very high risk of your code having logic errors.