Can the php get the number out of that line?



  • For example, line value $a = "абв351abc", can only php remove the numerical value from this line?



  • There are filters for this:

    echo(filter_var('asdasd0755asdasdasd', FILTER_SANITIZE_NUMBER_INT));//0755
    echo(filter_var('a13sdasd07.55asd', FILTER_SANITIZE_NUMBER_FLOAT , FILTER_FLAG_ALLOW_FRACTION)); //1307.55
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2