Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7722125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:05:34+00:00 2026-06-01T04:05:34+00:00

in PHP imagettftext, should I be able to make line breaks with \n in

  • 0

in PHP imagettftext, should I be able to make line breaks with “\n” in a string like this?

// The text to draw
$text = 'Something\nElse';

When I try this, the text outputted reads “Something\\nElse” with 2 back slashes before the n.

This does not result in a line-break.

Firstly, SHOULD a single slash n make a line break (\n)?
Secondly, How do i get it to work?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T04:05:35+00:00Added an answer on June 1, 2026 at 4:05 am

    \n is a line break only when the string is delimited with double quotes.

    echo 'Something\nElse';  // outputs Something\nElse
    echo "Something\nElse";  // outputs Something
                             //         Else
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically when I draw text it's ending up black like this: https://i.stack.imgur.com/z675F.png Instead of
in php, is there an easy way to draw text with imagettftext and imagefilledarc
<?php imagettftext($im, 15, 0, 470, $m, $black, $font, this is testing of all); ?>
I'm using php and gd library to draw a triangle. I'm able to draw
I'm using the PHP function imagettftext() to convert text into a GIF image. The
I have been using this simple script to generate images from text: <?php header('Content-type:
I'm trying to render images with verdana text using PHP imagettftext function. However, all
I am getting this error Could not find/open font When trying imagettftext() in PHP.
I tried to write an Arabic text in an image with PHP. This is
php -v gives this PHP Warning: PHP Startup: memcache: Unable to initialize module Module

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.