PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
Strpos Suchposition von bis
Beitrag
<blockquote data-quote="Zampano_" data-source="post: 1914777" data-attributes="member: 468122"><p><strong>AW: Strpos Suchposition von bis</strong></p><p></p><p>Naja, du könntest dein Array 2-dimensional aufbauen und den Vergleich in einer Schleife machen:</p><p></p><p>[PHP]</p><p>$suche_alle_protokolle = array();</p><p>$suche_alle_protokolle[0]["needle"] = 'http://';</p><p>$suche_alle_protokolle[0]["length"] = 7;</p><p></p><p> $suche_alle_protokolle[1]["needle"] = 'https://';</p><p>$suche_protokolle[1]["length"] = 8;</p><p> </p><p>$suche_alle_protokolle[2]["needle"] = 'ftp://';</p><p>$suche_alle_protokolle[2]["length"] = 6;</p><p></p><p></p><p>foreach ($suche_protokoll as $suche_protokoll) {</p><p> if (substr($url,0,$suche_protokoll["lenght"]) == $suche_protokoll["needle"]) {</p><p> echo 'Hab einen gefunden!';</p><p> }</p><p>} </p><p>[/PHP]<span style="font-family: 'Arial'"><span style="font-size: 12px"><span style="color: #000000"><span style="color: #0000BB"></span></span></span></span></p><p><span style="font-family: 'Arial'"><span style="font-size: 12px"><span style="color: #000000"><span style="color: #0000BB"></span></span></span></span></p><p><span style="font-family: 'Arial'"><span style="font-size: 12px"><span style="color: #000000"><span style="color: #0000BB"><span style="font-size: 10px"><span style="color: Black">Ob das jetzt für dich die passenste Logik ist, kann ich nicht entscheiden, da ich nicht ganz genau weiß was du vor hast.</span></span></span></span></span></span></p><p><span style="font-family: 'Arial'"><span style="font-size: 12px"><span style="color: #000000"><span style="color: #0000BB"><span style="font-size: 10px"><span style="color: Black">Was passiert denn eigentlich wenn die URL in der Mitte des Strings ist, ist die dann für dich uninteressant?</span></span></span></span></span></span></p><p><span style="font-family: 'Arial'"><span style="font-size: 12px"><span style="color: #000000"><span style="color: #0000BB"><span style="font-size: 10px"><span style="color: Black">Ansonsten würde sich hier dann doch mal ein Blick auf preg_match lohnen.</span></span> <img src="/styles/default/xenforo/smilies/zwinker.gif" class="smilie" loading="lazy" alt=";)" title="Wink ;)" data-shortname=";)" /></span></span></span></span></p><p><span style="font-family: 'Arial'"><span style="font-size: 12px"><span style="color: #000000"><span style="color: #0000BB"></span></span></span></span></p><p><span style="font-family: 'Arial'"><span style="font-size: 12px"><span style="color: #000000"><span style="color: #0000BB"></span></span></span></span></p></blockquote><p></p>
[QUOTE="Zampano_, post: 1914777, member: 468122"] [b]AW: Strpos Suchposition von bis[/b] Naja, du könntest dein Array 2-dimensional aufbauen und den Vergleich in einer Schleife machen: [PHP] $suche_alle_protokolle = array(); $suche_alle_protokolle[0]["needle"] = 'http://'; $suche_alle_protokolle[0]["length"] = 7; $suche_alle_protokolle[1]["needle"] = 'https://'; $suche_protokolle[1]["length"] = 8; $suche_alle_protokolle[2]["needle"] = 'ftp://'; $suche_alle_protokolle[2]["length"] = 6; foreach ($suche_protokoll as $suche_protokoll) { if (substr($url,0,$suche_protokoll["lenght"]) == $suche_protokoll["needle"]) { echo 'Hab einen gefunden!'; } } [/PHP][FONT=Arial][SIZE=3][COLOR=#000000][COLOR=#0000BB] [SIZE=2][COLOR=Black]Ob das jetzt für dich die passenste Logik ist, kann ich nicht entscheiden, da ich nicht ganz genau weiß was du vor hast. Was passiert denn eigentlich wenn die URL in der Mitte des Strings ist, ist die dann für dich uninteressant? Ansonsten würde sich hier dann doch mal ein Blick auf preg_match lohnen.[/COLOR][/SIZE] ;) [/COLOR][/COLOR][/SIZE][/FONT] [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ▲ = 5, ▼ = 2 und ■ = 7, was ist ▲ × ▼ + ■?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
Strpos Suchposition von bis
Oben