Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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 
"); 
?> 
Comment

explode php all values to int

$s = "1,2,3,8,2";
$ints = array_map('intval', explode(',', $s ));
var_dump( $ints );
Comment

PREVIOUS NEXT
Code Example
Php :: make model and migration in laravel 
Php :: laravel api form request validation 404 
Php :: laravel withHas 
Php :: how to add recaptcha validation in php 
Php :: Laravel Boot strap Pagination 
Php :: password hash php 
Php :: php trim string if longer than 
Php :: get template directory uri 
Php :: laravel blade variable isset, empty or optional 
Php :: php date start of day 
Php :: twig filter line break 
Php :: ajax post example php 
Php :: Undefined index: HTTP_HOST 
Php :: get url with php 
Php :: laravel tinker generate password 
Php :: laravel count group by date 
Php :: php read csv to array 
Php :: php remove last newline from string 
Php :: date formate in php 
Php :: remove foreign key constraint laravel 
Php :: carbon laravel d m y to y-m-d 
Php :: php clone 
Php :: how assign default value to laravel migration column 
Php :: php check connection to database 
Php :: update query in codeigniter using where condition 
Php :: how delete the table in laravel in the commend 
Php :: php ob_start 
Php :: laravel access JsonResponse content 
Php :: laravel collection transform 
Php :: delete in crud php 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =