3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '"Harry":"12345","Biswas":"789456","garry":"56894"'; $passwords = array(); foreach( str_getcsv( $str) as $entry) { list( $name, $pw) = explode( ':', $entry); $passwords[$name] = $pw; } echo $passwords["Harry"]; // 12345

preferences:
33.62 ms | 402 KiB | 5 Q