how to concatenate array index with its previous one?

1

I'm trying, within a classe , to create a property that will be populated by an array.

The problem is that the second index of this array depends on the value of the first one and would like to concatenate.

private $site = array (
    "dominio"           => "site.com.br",
    "www"               => "www.".->dominio,                

How to do this?

    
asked by anonymous 17.06.2018 / 15:19

1 answer

1

There's no way. What you can do is set the properties directly:

<?php

class Site 
{
    private $site = [
        'domain' => 'site.com.br',
        'www' => 'www.site.com.br'
    ];
}
    
17.06.2018 / 16:09