M. Sokolewicz wrote:
Jake McHenry wrote:
Hi everyone.
Is there a way to explode by every character in the variable?
Example:
$var = "8";
$test = explode("", $var);
output would be
$test[0] = 0;
$test[1] = 0;
$test[2] = 0;
$test[3] = 0;
$test[4] = 8;
Can I get an array like that?
Thanks,
Jake M
On Thu, 26 Aug 2004 00:57:43 +0200, in php.general
[EMAIL PROTECTED] (Felix) wrote:
>$array = explode( ' ', chunk_split( $sting, 1, ' ' ) );
>
>http://www.php.net/manual/de/function.explode.php
>http://www.php.net/manual/de/function.chunk-split.php
Well, that would leave a blank entry end of the
Try this:
$array = explode( ' ', chunk_split( $sting, 1, ' ' ) );
http://www.php.net/manual/de/function.explode.php
http://www.php.net/manual/de/function.chunk-split.php
On Thu, 26 Aug 2004 00:50:09 +0200, Peter Brodersen <[EMAIL PROTECTED]> wrote:
> Hi,
>
> On Wed, 25 Aug 2004 18:00:49 -0400
Hi,
On Wed, 25 Aug 2004 18:00:49 -0400, in php.general
[EMAIL PROTECTED] (Jake McHenry) wrote:
>Hi everyone.
>
>Is there a way to explode by every character in the variable?
>
>Example:
>
>$var = "8";
>$test = explode("", $var);
Use preg_split(): http://php.net/preg_split - example 2.
Or,
Jake McHenry wrote:
Hi everyone.
Is there a way to explode by every character in the variable?
Example:
$var = "8";
$test = explode("", $var);
output would be
$test[0] = 0;
$test[1] = 0;
$test[2] = 0;
$test[3] = 0;
$test[4] = 8;
Can I get an array like that?
Thanks,
Jake McHenry
MIS Coordinato
heh does the job :)
$value){
if ($value==1) {
print ''.$value.'';
}
}
?>
-Original Message-
From: Michael P. Carel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 20, 2002 5:54 AM
To:
Subject:
Petre Agenbag wrote:
> Hi
> The manual states:
>
> $pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
> $pieces = explode(" ", $pizza);
>
> So, if I want to be able to echo piece1 to the screen at a later
> stage, I would go:
>
> echo $pieces[0];
>
> or
> $first_piece = $pieces[0];
> echo $f
If that's the exact string you have (which I doubt) then your code
should look something like
Notes on the code above:
1. Your string most probably doesn't look like that, in which case
you'll have to adapt the code to it;
2. You'll have to do some custom changes to the first and last entry
8 matches
Mail list logo