2019獨角獸企業重金招聘Python工程師標準>>>
?
數組格式要求 id => pid
$columns= [
? ? '1' => 0,
? ? '10' => 1,
? ? '200' => 10? ? ????????????????
];
public function getP($columns,$pid)
? ? {
????? ? 模擬 $pid = 200;
? ? ? ? $arr = $columns;
? ? ? ? while($arr[$pid]) {
? ? ? ? ? ? $pid= $arr[$pid];
? ? ? ? }
? ? ? ? return $pid; //找到1
? ? }