Translating PHP to Powershell - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Wednesday, December 8, 2021

Translating PHP to Powershell

I'm currently translating a PHP script to Powershell, and I'm stuck at the following part:

$data = array();
foreach($extension_data as $key=>$value){
   array_push($data,array("name"=>$key,"value"=>$value));
}

Especially, what would the $key=>$value part look like in PowerShell?

EDIT: here's my solution

    $data = @()
        foreach($e in $extension_data.getenumerator()){
            $data += @{"name" = $($e.name); "value"=$($e.value)}
        }


source https://stackoverflow.com/questions/70250800/translating-php-to-powershell

No comments:

Post a Comment