hello,

this my code how i can do it

$word = "a,b"; 

echo $first;  /// a
echo $second; /// b

thanks

Recommended Answers

All 7 Replies

or i want just print second value the B

thanks

or better store it in an array and then using key value echo it simple....try this out

here is the code

<?
$word = "a,b"; 
$word=explode(',',$word);

echo $word[0]; 
echo "<br>"; /// a
echo $word[1]; /// b
?>

try this

<?php
$str = 'a,b,c,d';

$a=(explode(',', $str));
echo $a[0]."<br/>";
echo $a[1]."<br/>";
echo $a[2]."<br/>";
echo $a[3]."<br/>";
?>

thanks

and what about this array

$seatnumber = "d,s";
$array = array($seatnumber);
$count = count($array);
for ($i = 0; $i < $count; $i++) {
echo "ticket: $array[$i]";

	echo "</br>";
}

is not work check it please .

thanks

$seatnumber = "d,s";
$array = explode(',',$seatnumber);
$count = count($array);
for ($i = 0; $i < $count; $i++) {
echo "ticket: $array[$i]";

	echo "</br>";
}

try this:

<?php
$word = "ab";
echo substr($word, 0,1); //prints a
echo "<br />";
echo substr($word, 1,1); //prints b
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.