lucavilla Posted January 15, 2007 Share Posted January 15, 2007 Suppose that we have:$one = "abc123lmn"and we want to extract "123" out of it, with the simple regex [0-9], putting it in a variabile.What's the PHP complete command to do this? Quote Link to comment Share on other sites More sharing options...
effigy Posted January 15, 2007 Share Posted January 15, 2007 [code]<?php $one = 'abc123lmn'; preg_match('/\d+/', $one, $matches); $num = $matches[0];?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.