# gettraceasstring

Exception::getTraceAsString

Gets the stack trace as a string

# 

ENTITY

<div data-wrapper="1" role="Exception">

final

</div>

<div data-wrapper="1" role="Exception">

public

</div>

<div data-wrapper="1" role="Exception">

string

</div>

<div data-wrapper="1" role="Exception">

Exception::getTraceAsString

</div>

Returns the Exception stack trace as a string.

# 

ENTITY ENTITY

# 

ENTITY

Returns the Exception stack trace as a string.

# 

ENTITY

<div class="example">

<div class="title">

`Exception::getTraceAsString` example

</div>

```
<?php
function test() {
    throw new Exception;
}

try {
    test();
} catch(Exception $e) {
    echo $e->getTraceAsString();
}
?>

    
```

ENTITY

    #0 /home/bjori/tmp/ex.php(7): test()
    #1 {main}

        

</div>

# 

ENTITY

Throwable::getTraceAsString