How to substract numbers within a string in PHP? -


Say a string variable containing data data, say $ x = "OP / 12 / DIR"; The status of the number data can be changed in any case by changing the user's application to the will of the user, and slash bar can be replaced by any other character; But number data is mandatory. So what's the way to extract the number data from the string?

Change everything that is empty with no space string.

$ numbers = preg_replace ('/ [^ 0-9] * /', '', $ x);

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -