0

hello,

this my code how i can do it

$word = "a,b"; 

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

thanks

4
Contributors
7
Replies
8
Views
6 Years
Discussion Span
Last Post by terabyte
0

here is the code

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

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

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/>";
?>
0

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

Edited by WaleedaaN: n/a

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

	echo "</br>";
}

Edited by muralikalpana: n/a

0

try this:

<?php
$word = "ab";
echo substr($word, 0,1); //prints a
echo "<br />";
echo substr($word, 1,1); //prints b
?>

Edited by terabyte: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.