Results 1 to 4 of 4

Thread: How to declare print function in PHP

  1. #1
    Join Date
    Apr 2009
    Posts
    89

    How to declare print function in PHP

    I am learning with the PHP language and need to have the basic print() function, the function would be such that it should print the value given in the program also provide me some information related to it.This would be really helpful for me, as i will be implementing this in my project file.

    Thanks in Advance

  2. #2
    Join Date
    Dec 2008
    Posts
    202

    Re: How to declare print function in PHP

    The print() function is not actually a function, so you are not required to use parentheses with it.

    Tip: The print() function is slightly slower than echo().

    PHP Code:
    <?php
    $str 
    "Who's Kai Jim?";
    print 
    $str;
    print 
    "<br />";
    print 
    $str."<br />I don't know!";
    ?>

  3. #3
    Join Date
    Jan 2006
    Posts
    211

    Re: How to declare print function in PHP

    If you wanted to just print the value of a variable (which is what you seem to be doing) then there is no need to write the quotes around the value you declare. You will be needed to put quotes around a variable if you were trying to interpolate its value into a string, so:

    PHP Code:
    $var 'World';
    print 
    "Hello $var!"

  4. #4
    Join Date
    Jan 2009
    Posts
    143

    Re: How to declare print function in PHP

    If the dialog box is the same one when you hit Ctrl+P on the keyboard (which i'm sure it is), then it is best if left that way. It probably isn't the quotes since nothing outside your php brackets would cause it not to print. rather more likely your variable doesn't exist. This allows users to pick the printer they want if they have more than one printer to choose from and it also allows them to modify the page margins, how many pages they want to print, etc.

Similar Threads

  1. How to disable Print Screen function on Windows
    By VauGhna in forum Windows Security
    Replies: 8
    Last Post: 29-04-2014, 03:14 AM
  2. Print screen function spoils the picture in Toshiba laptop
    By Arup Singh in forum Portable Devices
    Replies: 6
    Last Post: 17-02-2012, 11:45 PM
  3. What is the Declare Construct in PHP?
    By Rob Dizzle in forum Software Development
    Replies: 5
    Last Post: 06-03-2010, 03:51 AM
  4. How to declare the header() function in php?
    By Joko in forum Software Development
    Replies: 3
    Last Post: 10-09-2009, 03:28 PM
  5. Print Screen Function
    By dave@at in forum Windows XP Support
    Replies: 3
    Last Post: 14-03-2007, 11:48 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,566,234.32025 seconds with 17 queries