LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-21-2016, 03:51 AM   #1
fhleung
Member
 
Registered: Aug 2004
Distribution: Lubuntu Live OS
Posts: 432

Rep: Reputation: 30
PHP function : print() and echo()


please tell the difference between
Code:
print() and echo()
in PHP script please? thank you

thx for reply, I not EXPERT programmer, so googled but no documentation output.
again, I can able to google but...

but I not know the answer.

Last edited by fhleung; 07-23-2016 at 10:19 PM.
 
Old 07-21-2016, 05:02 AM   #2
hydrurga
Senior Member
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 18.2 MATE
Posts: 3,491
Blog Entries: 2

Rep: Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198
Quote:
Originally Posted by fhleung View Post
please tell the difference between
Code:
print() and echo()
in PHP script please? thank you
Hi fhleung,

If you Google "php print or echo", you will find a whole host of articles and discussions on the differences (there aren't many).

It will take you 10-15 minutes to look at a few articles and make a list of the differences. Would you like to post a summary of your findings here to help others?
 
2 members found this post helpful.
Old 07-23-2016, 10:24 PM   #3
fhleung
Member
 
Registered: Aug 2004
Distribution: Lubuntu Live OS
Posts: 432

Original Poster
Rep: Reputation: 30
thanks, also if programming in Python programming language , code below , please copy and paste... easy =)

Code:
import urllib.request  # urllib2 try
f = urllib.request.urlopen('http://www.python.org/')
print(f.read(100).decode('utf-8'))

from here source url link

Code:
import urllib2
f = urllib.request.urlopen('http://www.python.org/')
print(f.read(100).decode('utf-8'))

reply: the hosting company I having, I put simply hello world Python script, but no luck
I not know any hosting company can host Python script
I tryED anyway~

Last edited by fhleung; 07-24-2016 at 11:12 PM.
 
Old 07-24-2016, 07:19 AM   #4
hydrurga
Senior Member
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 18.2 MATE
Posts: 3,491
Blog Entries: 2

Rep: Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198
How did you get on with looking at the differences between php's print and echo? Can you list the differences here? You don't need to be an expert programmer to search the internet, and there are many sites listing the differences.

I hope you don't mind me saying so, but your question about Python is a different topic and so you should really have started a new thread for it.

What exactly is your question? Are you programming in Python 2 or Python 3? The reason I ask is that if you're using Python 3, you should be using urllib.request (and urllib.parse and urllib.error if required), not urrlib or urllib2. You might also want to look at the excellent Requests library (http://requests.readthedocs.io/en/master/).
 
Old 09-04-2016, 11:28 PM   #5
fhleung
Member
 
Registered: Aug 2004
Distribution: Lubuntu Live OS
Posts: 432

Original Poster
Rep: Reputation: 30
xterm (297)
dd 8.21
dpkg 1.17.5
wget 1.15
PERL 5.18.2
PYTHON 2.7.6

firefox 44.0.2 / 39.0 / 28.0
 
Old 09-05-2016, 12:06 AM   #6
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,321

Rep: Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008
What should this list suggest us?

Last edited by NevemTeve; 09-05-2016 at 12:35 PM.
 
Old 09-21-2017, 05:03 AM   #7
mount.nfs
LQ Newbie
 
Registered: Feb 2017
Posts: 9

Rep: Reputation: Disabled
have you check the permission bit of your Python script?
GROUP has to be zero like 705 , 505 ...
 
Old 09-21-2017, 05:10 AM   #8
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,321

Rep: Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008Reputation: 1008
Has the Chaos invaded this topic? Completely unrelated posts, neither of them seems to make any sense... (including this one, obviously)
 
Old 09-21-2017, 04:07 PM   #9
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,526
Blog Entries: 6

Rep: Reputation: 2435Reputation: 2435Reputation: 2435Reputation: 2435Reputation: 2435Reputation: 2435Reputation: 2435Reputation: 2435Reputation: 2435Reputation: 2435Reputation: 2435
Please limit your discussion to the original topic - the difference between PHP print() and echo() functions.

If you have a separate question on another topic, please start another thread for that.

Also please see the Site FAQ and this page for guidance in asking well formed questions.

As others have suggested, a simple search for "php difference print echo" produces many helpful hits such as this one.

Perhaps the best way to answer that would be to read the PHP manual pages for print and echo and think about the information provided there.

Please read the above references and perform your own additional research for the answer, and return here if there is anything you do not understand.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What's the difference between PHP echo() and PHP print()? Mario2027 Programming 6 12-02-2010 11:20 AM
echo from a function JohnnyBoy123 Linux - Newbie 8 04-20-2009 08:28 PM
how to print function names & parmaters each time control enters the function? tanniru Linux - Networking 1 09-11-2008 02:21 AM
print job spools out but does not initiate print function john test Linux - Newbie 7 07-23-2008 06:13 PM
Passing one php function result as a parameter to another php function davee Programming 13 09-12-2004 01:08 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration