Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
文字列を配列に分割して、文字列が次の z10k4m42ようになるようにしようとしています
z10k4m42
array('z' => 10, 'k' => 4, 'm' => 42)
これは可能ですか?
以下を試してください:
preg_match_all('/([a-z]+)(\d+)/', 'z10k4m42', $matches); $ret = array_combine($matches[1], $matches[2]);