explode or any other way

Started on the old forum in August 2011 · view the original in the archive · old links redirect here

5 replies · 425 views · started 15 years ago · 1 min read

5 participants
atef Developer · 224 posts #2

Try this script cutting a part from page using explode

function cut($start,$end,$from)
{
$s = $from;
$r = explode($start, $s);
$x = explode($end, $r[1]);
return $x[0];
}
$text=cut('c','text2',$file);
i0nutzxp Developer · 150 posts #3
$file= ' c/text1text2">text3 ';

$arr = explode("\"", trim($file));

//$arr = explode('"', trim($file)); 
var_dump($arr);
<?php unlink('World/Europe/Romania.country'); ?>
CreativityKills Lead · 833 posts #4

athora wrote: $file= ' c/text1text2">text3 ';

I want to get the c/text1text2 part from above $file

I've tried with explode('"','$file') But not worked.

Any other way or different way of using explode ?

$file= ' c/text1text2">text3  ';
list($part_one, $remaining) = explode('"', $file, 2);
echo $part_one;

$part_one = substr($file, strpos('"', $file));
echo $part_one;

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close