Answers for "php preg_split numbers"

PHP
1

php divide string into parts

$str = explode('=', 'Hello=World');
echo 'str[0] : ' . $str[0] . '<br'>;
echo 'str[1] : ' . $str[1] . '<br'>;

// printout : 
// str[0] : Hello
// str[1] : World
Posted by: Guest on January-02-2022
1

how to separate integer from string in php

phpCopy<?php 
$string = 'Sarah has 4_dolls  8_dolls and 6 bunnies.';
$int = (int) filter_var($string, FILTER_SANITIZE_NUMBER_INT);  
echo("The extracted numbers are: $int \n"); 
?>
Posted by: Guest on March-09-2021

Browse Popular Code Answers by Language