3v4l.org

run code in 300+ PHP versions simultaneously
<?php $profiles = [ 'entity_weight_boost' => [ 'score_mode' => 'sum', 'functions' => [ [ // Incoming links: k = 100, since it is normal to have a bunch of incoming links 'type' => 'satu', 'weight' => '0.6', 'params' => [ 'field' => 'incoming_links', 'missing' => 0, 'a' => 1 , 'k' => 100 ] ], [ // Site links: k = 20, tens of sites is a lot 'type' => 'satu', 'weight' => '0.4', 'params' => [ 'field' => 'sitelink_count', 'missing' => 0, 'a' => 2, 'k' => 20 ] ], [ // (De)boosting by statement values 'type' => 'term_boost', 'weight' => 0.1, 'params' => [ 'statement_keywords' => [ // Q4167410=Wikimedia disambiguation page 'P31=Q4167410' => -10, // T183510: // Q13442814=scientific article 'P31=Q13442814' => -5, // Q18918145=academic journal article 'P31=Q18918145' => -5, ] ] ] ], ], ]; $overrides = [ 'entity_weight_boost.functions.2.params.statement_keywords' => 'SomeOverride' ]; function setDotted(array $path, &$arg, $val) { $key = array_shift($path); if (!isset($arg[$key])) { return; } if (count($path) === 0) { $arg[$key] = $val; } else { setDotted($path, $arg[$key], $val); } } foreach ( $overrides as $path => $configVar ) { setDotted(explode(".", $path), $profiles, ['a' => 1]); } var_dump($profiles);

preferences:
52.28 ms | 402 KiB | 5 Q