0

I would like assistance to get an output of the string after var: instead of just the first word. Is this possible, and what is the basics to doing so. Thanks.

<?php
$string = "var:Kids Choice Awards iOS Application. change sql.";
sscanf($string,"var:%s",$var);
// show types and values
var_dump($var);
echo "$var";
?>

//output----------

string 'Kids' (length=4)
Kids

//end Output-------

4

1 回答 1

0

您可以使用 "%[regex]" 格式

<?php

$string = "var:Kids Choice Awards iOS Application. change sql.";
sscanf($string,"var:%[^&]", $var);
// show types and values
var_dump($var);
echo "$var";
?>
于 2012-09-15T08:55:30.940 回答