|
użytkowników online: 15
|
OPINIE UŻYTKOWNIKÓW
|
Przyznam, że jestem pod sporym wrażeniem. Od wielu lat zajmuje się grafiką przeznaczoną do druku ze szczególnym uwzględnieniem opakowań. Z radością stwierdzam, iż twórca serwisu jest moim ulubionym typem potencjalnego współpracownika (choć branża troszeczkę inna) tzn. pada pytanie i błyskawicznie pada konkretna odpowiedź bez względu na stopień skomplikowania pytania. Gorąco polecam współpracę, gdyż macie pewność że nie zostaniecie potraktowani sloganami typu "oczywiście", "nie ma sprawy" tylko otrzymacie konkretną pomoc. Tak trzymać! Na pewno jeszcze nie raz skorzystam
Paweł
Studio Gama
|
|
PODRĘCZNIK PHP 5.x, 4.x, 3.x - częściowo spolszczony / źródło: www.php.net
[Spis]
[A]
[B]
[C]
[D]
[E]
[F]
[G]
[H]
[I]
[J]
[K]
[L]
[M]
[N]
[O]
[P]
[Q]
[R]
[S]
[T]
[U]
[V]
[X]
[W]
[Z]
strstr (PHP 3, PHP 4, PHP 5) strstr -- Find first occurrence of a string Descriptionstring strstr ( string haystack, string needle )
Returns part of haystack string from the
first occurrence of needle to the end of
haystack.
If needle is not found, returns FALSE.
If needle is not a string, it is converted
to an integer and applied as the ordinal value of a character.
Notatka:
This function is case-sensitive. For case-insensitive searches, use
stristr().
Przykład 1. strstr() example |
<?php
$email = 'user@example.com';
$domain = strstr($email, '@');
echo $domain; ?>
|
|
Notatka:
If you only want to determine if a particular needle
occurs within haystack, use the faster and less memory
intensive function strpos() instead.
strstr() has been binary safe since PHP 4.3.0
See also ereg(), preg_match(),
stristr(), strpos(),
strrchr(), and substr().
User Contributed Notesonuryerlikaya at hotmail dot com
25-Jan-2006 09:00
<?php
$piece = 6;
$data = 'djhfoldafg9d7yfr3nhlrfkhasdfgd';
$piece1 = substr($data,0,$piece);
$piece2 = strstr($data,substr($data,$piece,$piece));
echo '$piece1 :'.$piece1; echo "<br>";
echo '$piece2 :'.$piece2; ?>
You can piece your string which given at $piece variable.
always_sleepz0r at removethisyahoo dot co dot uk
15-Jan-2006 08:38
//this is my little version
function rdir($d_d, $filter = null) {
$d = dir($d_d);while(false !== ($entry = $d->read())) {
if ($entry!=".." && $entry!="." && $filter==null || true==stristr($entry, $filter)){ if (!is_dir($entry)) {
$ret_arr['f'][]=$entry;}else{$ret_arr['d'][]=$entry;
}}}$d->close();return $ret_arr;}
//usage:
$d="folder";
$dd=rdir($d);
//will return array with all files and folder names
$dd=rdir($d, "requiredneedle");
//will return array with only file/folder names containing "requiredneedle".
//$dd['f'] = files and $dd['d'] = folders
echo "<pre>";print_r($dd);echo "</pre>";
nospam AT thenerdshow.com
16-Nov-2005 01:20
It is a good practice to ensure dropdown menu submissions contain ONLY expected values:
$i=(isset($_POST['D1']))?$_POST['D1']:$o="Monday";
if (!stristr('Monday Tuesday Wednesday Thursday Friday Saturday Sunday',$i)) die();
(do database query)
This should protect against all known and unknown attacks, injection, etc.
User submitted should be cleaned through other functions. See info under mysql_query
06-Jun-2005 06:13
suggestion for [leo dot nard at free dot fr]:
to be able to cut the string without having the html entities being cut in half, use this instead:
<?php
$oldstr = "För att klippa av en sträng som innehåller skandinaviska (eller Franska, för den delen) tecken, kan man göra såhär...";
$length = 50;
$newstr = htmlentities(substr(html_entity_decode($oldstr), 0, $length));
$newstr2 = substr($oldstr, 0, $length);
echo "Without the decode-encode snippet:
$newstr2
With the decode-encode snippet:
$newstr";
?>
The above outputs this:
Without the decode-encode snippet:
För att klippa av en sträng som inneh&ar
With the decode-encode snippet:
För att klippa av en sträng som innehåller skandin
First post in this db ;)
Best regards, Mikael R
|