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 8603359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:18:17+00:00 2026-06-12T02:18:17+00:00

also these two line: $subForm = $this->{$spec} $subForm = $spec; public function prepareSubForm($spec) {

  • 0

also these two line:

$subForm = $this->{$spec}
$subForm = $spec;

public function prepareSubForm($spec)

{
    if (is_string($spec)) {
        $subForm = $this->{$spec};
    } elseif ($spec instanceof Zend_Form_SubForm) {
        $subForm = $spec;
    } else {
        throw new Exception('Invalid argument passed to ' .
                __FUNCTION__ . '()');
    }
    $this->setSubFormDecorators($subForm)
    ->addSubmitButton($subForm)
    ->addSubFormActions($subForm);
    return $subForm;
}
  • 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-12T02:18:18+00:00Added an answer on June 12, 2026 at 2:18 am

    It’s said in the Variable Variables part of the documentation:

    Curly braces may also be used, to clearly delimit the property name.
    They are most useful when accessing values within a property that
    contains an array, when the property name is made of mulitple parts

    In this code there’s no syntax-related reason to use $this->{$spec} instead of $this->$spec.

    But:

    • the first form may be more readable to some teams (= enforced by the code conventions)

    • perhaps in the past there was an expression here (like $this->{'_' . $spec}), for example. And if you try to use an expression as ‘variable property name’, you need to use curve braces to delimit it.

    As for difference between $spec and $this->$spec, it’s more clear. This method can work with two types of its single argument:

    • if $spec is of String type, it’s viewed as the name of property; this property is what will be processed (decorated) later;

    • if $spec is Zend_Form_SubForm object, this object will be decorated instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How would you do this PHP switch statement? Also note that these are much
A Jquery Modal is called with two form elements. There is also an option
Iam making an app which has one index.php file. I also have these other
These days web addresses can also include non-ASCII characters. So every modern browser and
I have 4 string arrays,each of these array's length is 4. I also have
There seem to be a .CFI directive after every line and also there are
Simple problem - How do I get these two divs to share the same
I have images which have line segments, rays etc. I am representing these line
By oddities, I mean these two things: Functions in the first parameter need to
I have these two pointers, amen and ptr , where all the values i

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.