Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6129087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:42:06+00:00 2026-05-23T16:42:06+00:00

I have just started learning PHP, and here’s my first doubt… Both of these

  • 0

I have just started learning PHP, and here’s my first doubt…

Both of these work:

<?php
$function1 = "Aahan";
print "Hi, $function1";
?>

and

<?php
$function2 = Aahan;
print "Hi, $function2";
?>

See the difference? In the second example I didnt use the “” (quotation marks) for the variable string. But it still works.

Also, the stupid author of the book (which I wont name), uses “” in some examples and doesnt use them in some, without explanation. So, what should I think? Either way is okay or what do you advise?

EDIT: Sorry guys, the author is a good one. I misunderstood this string $x = 3;, and started checking out the above examples. Just realized that constants don’t need quotes. Sorry again.

EDIT-2: it doesn’t show me any error like you all have mentioned. How do I make it show the errors? or is it something wrong with my server itself? (I dont think so)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:42:06+00:00Added an answer on May 23, 2026 at 4:42 pm

    Aahan,

    $function1 = "Aahan";
    

    Is the right method for php. Its a string of chareters. Refer to php strings.

    Now when you do

    $function2 = Aahan;
    

    Php searches for a constant Aahan and when its not defined it treats it as a string. To explain further. Consider these:

    $function1 = "Aahan Is My Name";
    

    And

    $function2 = Aahan Is My Name;
    

    While the first one with ” “(quotes) is right. The 2nd one gives you a syntax error.

    This is the warning gernerated, unless you have turned it off

    Notice: Use of undefined constant Aahan – assumed ‘Aahan’

    EDIT: To turn on comprehensive Error reporting Add the following code to the first line of your code.

    error_reporting(E_ALL);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started learning ruby on rails. I have a doubt wrt routing.
I have just started learning pthreads API and I am following the tutorial here
I have just started learning XNA. This is my first program that I am
I have just started learning coding and PHP so I have been looking at
I just started learning Zend (& OO PHP for that matter), I have spent
I have just started learning Erlang and am trying out some Project Euler problems
I have just started learning Jquery and am new to writing javascript (I am
I have just started learning MVVM and having a dilemna. If I have a
I have just started learning NHibernate. Over the past few months I have been
I have just started writing my own JavaScript Framework (just for the learning experience),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.