object convert to string php code example Example 1: object to string php (string)$yourObject; Example 2: convert to string php echo "'$animal'";