0

suppose we have strings like "adjkadahsdjashd##kjhkhkjhkjhs" . and I want to cut them to for example adjkadahsdjashd and kjhkhkjhkjhs

so I wrote this on my computer :

<?php
$s="508462170##dfsfgdfggf";
echo substr($s,strpos($s,"#")+2)."</br>";
echo substr($s,0,strpos($s,"#"));
?>

and the result is okay , but when I upload this to server , it returns me nothing .

server php version is 5.2.17

:(

Cyb3r
  • 187
  • 1
  • 1
  • 10
  • Did you try it exactly like this, or is it only a part of your test file? Tried it on an appache server and it worked. Maybe you want to add an `echo "test";` to make sure that there is a result at all. – martinstoeckli May 10 '11 at 12:47

2 Answers2

0

Try echoing the result of strpos() to narrow the problem down.

Alex
  • 32,506
  • 16
  • 106
  • 171
0

An shorter way for your problem would be:

echo implode('<br/>', explode('##', $s));

did this work on booth platforms.

Also </br>is not valid HTML.

DanielB
  • 19,910
  • 2
  • 44
  • 50