LinuxQuestions.org
Help answer threads with 0 replies.
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, 02: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 09:19 PM.
 
Old 07-21-2016, 04:02 AM   #2
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
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, 09: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 10:12 PM.
 
Old 07-24-2016, 06:19 AM   #4
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
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, 10: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-04-2016, 11:06 PM   #6
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,851
Blog Entries: 1

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

Last edited by NevemTeve; 09-05-2016 at 11:35 AM.
 
Old 09-21-2017, 04:03 AM   #7
mount.nfs
Member
 
Registered: Feb 2017
Posts: 58

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, 04:10 AM   #8
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,851
Blog Entries: 1

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
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, 03:07 PM   #9
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,258
Blog Entries: 24

Rep: Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193Reputation: 4193
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 10:20 AM
echo from a function JohnnyBoy123 Linux - Newbie 8 04-20-2009 07:28 PM
how to print function names & parmaters each time control enters the function? tanniru Linux - Networking 1 09-11-2008 01:21 AM
print job spools out but does not initiate print function john test Linux - Newbie 7 07-23-2008 05:13 PM
Passing one php function result as a parameter to another php function davee Programming 13 09-12-2004 12:08 PM

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

All times are GMT -5. The time now is 03:02 AM.

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
Open Source Consulting | Domain Registration