note 71160 added to function.strstr
| From: | aspje at hotmail dot com | Date: | Tue, 14 Nov 2006 12:38:46 +0000 |
| Subject: | note 71160 added to function.strstr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119715@lists.php.net to get a copy of this message | ||
Why onuryerlikaya uses strstr AND substr just to split a string is not totally clear... also $piece
= 0 would not give the expected result.
the next code gives the exact same thing AND will work for $piece = 0
<?php
$piece = 6;
$data = 'djhfoldafg9d7yfr3nhlrfkhasdfgd';
$piece1 = substr($data,0,$piece);
$piece2 = substr($data,$piece);
echo '$piece1 :'.$piece1; // $piece1 :djhfol
echo "<br>";
echo '$piece2 :'.$piece2; // piece2 :dafg9d7yfr3nhlrfkhasdfgd
?>
----
Server IP: 83.137.20.120
Probable Submitter: 213.201.153.14 (proxied: 10.0.50.99)
----
Manual Page -- http://www.php.net/manual/en/function.strstr.php
Edit -- https://master.php.net/note/edit/71160
Del: integrated -- https://master.php.net/note/delete/71160/integrated
Del: useless -- https://master.php.net/note/delete/71160/useless
Del: bad code -- https://master.php.net/note/delete/71160/bad+code
Del: spam -- https://master.php.net/note/delete/71160/spam
Del: non-english -- https://master.php.net/note/delete/71160/non-english
Del: in docs -- https://master.php.net/note/delete/71160/in+docs
Del: other reasons-- https://master.php.net/note/delete/71160
Reject -- https://master.php.net/note/reject/71160
Search -- https://master.php.net/manage/user-notes.php