Answers for "explode php make integers"

PHP
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
2

explode example in php

$str = "Hello, kinjal, how, are, you";

    // it will convert string to array
    $s1 = explode(",", $str);
    echo "<pre>";
    print_r($s1);
Posted by: Guest on September-29-2021

Browse Popular Code Answers by Language