3v4l.org

run code in 300+ PHP versions simultaneously
<?php $variables = [ "own" => [ "type" => "bool", "value" => 0 ], "contr_name" => [ "type" => "bool", "value" => 0 ], "all_votes" => [ "type" => "int", "value" => 0 ], "contract_start" => [ "type" => "bool", "value" => 0 ], "contract_end" => [ "type" => "bool", "value" => 0 ], "T" => [ "type" => "clock", "value" => '' ], "a" => [ "type" => "int", "value" => 1 ], "candi_ID" => [ "type" => "int", "value" => 1 ], "voter_ID" => [ "type" => "int", "value" => 1 ], /* [] => [ "type" => '', "value" => '' ] */ ]; $variable = "own=1, contract_start=1"; function updateTheValue(&$variables,$variable) { // Split variable looking for into name and value $vars = explode(",", $variable); $match = false; foreach ($vars as $var){ $expbyequal = explode("=", $var); // If this key exists in main keys if ( in_array(trim($expbyequal[0]), array_keys($variables)) ) { // Compare value with stored value if ( $variables [trim($expbyequal[0])]['value'] == trim($expbyequal[1]) ) { $match = true; }else{ $variables[trim($expbyequal[0])]["value"] = trim($expbyequal[1]); $match = false; } } } return $match; } updateTheValue($variables,$variable); print_r($variables);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [own] => Array ( [type] => bool [value] => 1 ) [contr_name] => Array ( [type] => bool [value] => 0 ) [all_votes] => Array ( [type] => int [value] => 0 ) [contract_start] => Array ( [type] => bool [value] => 1 ) [contract_end] => Array ( [type] => bool [value] => 0 ) [T] => Array ( [type] => clock [value] => ) [a] => Array ( [type] => int [value] => 1 ) [candi_ID] => Array ( [type] => int [value] => 1 ) [voter_ID] => Array ( [type] => int [value] => 1 ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
116.31 ms | 408 KiB | 5 Q