$message = new Swift_Message(); $message->setSubject('Hello World');
$subject = 'Order Confirmation'; $message = new Swift_Message(); $message->setSubject($subject);In this example, we create a variable called $subject and set it to 'Order Confirmation'. We then create a new message instance using the Swift_Message class and set its subject line to the value of $subject using the setSubject method. Overall, the code examples show how to use the Swift_Message setSubject method to set the subject line of an email message in PHP using the Swift Mailer package library.