array
Thread Tags
Adobe Illustrator Adobe InDesign Adobe Photoshop Android Development Android Programming Android Studio Automation Testing C / C++ Programming Career Options College Lounge css digital marketing Digital Marketing / SEO Fireworks Graphic Design Graphic designing Graphics Design Graphics Designing HTML? Illustrator Internship Training logo Design logo designing Magento Photoshop PHP Programming QA react-native Scroll Website SEO Single Page Website Stock Managment System Testing Typography UI UI/UX Development UI Design UI Designing UI development User Interface UX Design Web Designing Website Design Wordpress wpRegister for free!
Registration at Smart Mentors is completely free and takes only a few seconds. By registering you’ll gain:
- Full Posting Privileges.
- Access to Private Messaging.
- Optional Email Notification.
- Ability to Fully Participate.
Register Now, or check out the Site Tour and find out everything Smart Mentors has to offer.
This thread contains 3 replies, has 4 voices, and was last updated by Anonymous 2 years ago.
- Author Replies
- January 2, 2018 at 2:33 pm #34764
Hello Rushi,
print is used to print a single line whereas we can use multiple lines with echo function.
Example:
$str = “Hello meet”;
$str1 = “Patel”;
print $str; // Output will display a “Hello meet” when you will run the script
print $str,$str1; // Output of this line will be a syntax error.
echo $str,$str1; // Output of this line will be a “Hello meet patel”;
Moreover echo is faster than the print statement.
Php-Mentor
- January 2, 2018 at 4:24 pm #34796
Hello ,
echo and print are more or less the same. They are both used to output data to the screen. The differences are small: echo has no return value while print has a return value of 1 so it can be used in expressions. echo can take multiple parameters (although such usage is rare) while print can take one argument.
For Example :-
echo “This “, “string “, “was “, “made “, “with multiple parameters.”; //this is valid
Print “This “, “string “, “was “, “made “, “with multiple parameters.”; // this is not valid
Anonymous
December 25, 2018 at 3:00 pm #50599Hey Meet,
In a nutshell, echo and print both are PHP Statement.
Both are used to display the output in PHP.Echo:
1. It can be used with or without parentheses;
2. echo can pass multiple strings separated as ( , );
3. echo doesn’t return any valuePrint
1. Print can don’t pass multiple arguments
2. Print always return 1
3. It is slower than echoHope this helps!
- AuthorPosts
You must be logged in to reply to this thread.Please login or register. Registration is 100% free.