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

  • SEARCH
  • Home
  • 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 8455757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:21:58+00:00 2026-06-10T12:21:58+00:00

I see this (@var) in php comments a lot and have no clue what

  • 0

I see this (@var) in php comments a lot and have no clue what it means. Please tell.

// example.php (taken from yii framework application code)

<?php
/* @var $this CategoriesController */
/* @var $data Categories */
?>

<div class="view">

    <b><?php echo CHtml::encode($data->getAttributeLabel('idCategory')); ?>:</b>
    <?php echo CHtml::link(CHtml::encode($data->idCategory), array('view', 'id'=>$data->idCategory)); ?>
    <br />
</div>
  • 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-06-10T12:21:59+00:00Added an answer on June 10, 2026 at 12:21 pm

    You may use the @var tag to document the data type of class variables.

    The datatype should be a valid PHP type (int, string, bool, etc), a
    class name for the type of object, or simply "mixed". phpDocumentor
    will display the optional description unmodified, and defaults to
    "mixed" if the datatype is not present

    https://manual.phpdoc.org/HTMLSmartyConverter/PHP/phpDocumentor/tutorial_tags.var.pkg.html

    With the @var tag it is possible to document the type and function of a class property. When provided it MUST contain a Type to indicate
    what is expected; the description on the other hand is OPTIONAL yet
    RECOMMENDED in case of complicated structures, such as associative
    arrays.

    The @var tag MAY have a multi-line description and does not need
    explicit delimiting.

    It is RECOMMENDED when documenting to use this tag with every
    property.

    This tag MUST NOT occur more than once per property in a PHPDoc and is
    limited to Structural Elements of type property.

    Example:

    class DemoVar
    {
       /**
        * Summary
        *
        * @var object Description
        */
       protected $varWithDescriptions;
    
       /**
        * @var \DemoVar $instance The class instance.
        */
       protected static $instance;
    
       /**
        * Summary for varWithWrongType
        *
        * @var boolean The varWithWrongType. Boolean will be put in the type.
        */
       protected $varWithWrongType = array();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

see this demo from jquery ui you have to hold down the Ctrl key
Please see this example: if (strlen($_SESSION['userDetails']['THISNAME']) == 0) { $_SESSION['userDetails'][''.$THISNAME.'Error'] = autofocus; include $docRoot/html/forms/reg/user_info.html.php;
* edit have fixed this code - see inline comments marked EDIT * I'm
See this code: var jsonString = '{id:714341252076979033,type:FUZZY}'; var jsonParsed = JSON.parse(jsonString); console.log(jsonString, jsonParsed); When
See this example! int main( int argc, char ** argv ) { int *ptr
Just see this: SELECT clientid,clientname,startdate,enddate,age FROM clients WHERE clientid IN (1,2,3,4,5) AND CASE WHEN
I have this star rating, I implemented from jQuery and I need to save
Saw this example on the jQuery examples page for Ajax: var xmlDocument = [create
I'm brand new to php so struggling to figure this one out from existing
OK so i have this website, http://www.leinstein.dk . You will see Hello World! This

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.