PHP数组声明:从现有键分配值

Found it hard to make a question title that can make sense. I'll explain better with an example:

$defaults = [
   'user_posts' => [
      'default_per_line' => 4,
      'default_per_page' => [user 'default_per_line'] * 2,
   ],
   'admin_posts' => [
      'default_per_line' => 6,
      'default_per_page' => [admin 'default_per_line'] * 2,
   ],
];

What I mean by 'user default_per_line' is using using the value already assigned as ['user_posts']['default_per_page'] and multypling it with 2 (or anything else).

Can it be done? If so how?

Pretty sure I'm right in saying no, it can't be done in a single assignment.

Only way you could do it would be to alter the array after the fact:

$defaults = [
   'user_posts' => [
      'default_per_line' => 4,
      'default_per_page' => 0,
   ],
   'admin_posts' => [
      'default_per_line' => 6,
      'default_per_page' => 0,
   ],
];
$defaults['user_posts']['default_per_page'] = $defaults['user_posts']['default_per_line'] * 4;
$defaults['admin_posts']['default_per_page'] = $defaults['admin_posts']['default_per_line'] * 4;

Which largely defeats the point of what you are trying to do.