LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   PHP function : print() and echo() (https://www.linuxquestions.org/questions/programming-9/php-function-print-and-echo-4175585195/)

fhleung 07-21-2016 02:51 AM

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.

hydrurga 07-21-2016 04:02 AM

Quote:

Originally Posted by fhleung (Post 5579212)
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?

fhleung 07-23-2016 09:24 PM

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~

hydrurga 07-24-2016 06:19 AM

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/).

fhleung 09-04-2016 10:28 PM

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

NevemTeve 09-04-2016 11:06 PM

What should this list suggest us?

mount.nfs 09-21-2017 04:03 AM

have you check the permission bit of your Python script?
GROUP has to be zero like 705 , 505 ...

NevemTeve 09-21-2017 04:10 AM

Has the Chaos invaded this topic? Completely unrelated posts, neither of them seems to make any sense... (including this one, obviously)

astrogeek 09-21-2017 03:07 PM

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.


All times are GMT -5. The time now is 09:22 PM.