Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

An easy way to remember whether to 'echo'?

Featured Replies

Hello,

 

I'm just learning php at the moment and probably have a stupidly easy question!!!

 

I'm getting confused on when 'echo' should be typed into a string or left out? Is there an easy way to remember when it needs to be included/left out?

 

Gary :)

  • Author

If you want something to be output, you need to use echo, print, or in more severe (last output moments) exit or die

 

Thanks.

 

I haven't got to exit or die yet but sure they'll crop up soon. :)

As a rule of thumb you should write your functions to return a value rather than echoing unless their sole purpose is to take an input, format it and echo it to the screen. The perfect function performs one job. It's fine to pass the output of one function to another function to format and echo, or just echo the returned value of a function with:

 

echo my_function();

Edited by Renaissance-Design

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.