Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

WaiThaw's avatar

Required parameter $dompdf follows optional parameter $paper

These errors are why?help me

0 likes
3 replies
sr57's avatar

Give some precision, context & code

WadeShuler's avatar

Seems like you are getting this error because the optional params should go at the end.

Bad:

function badExample($paper = null, $dompdf) {}

Good:

function goodExample($dompdf, $paper = null) {}

Since paper is optional, it must go after all required parameters.

Please or to participate in this conversation.