Post
#1
|
|
|
Grupa: Zarejestrowani Postów: 3 Pomógł: 0 Dołączył: 14.05.2003 Skąd: Kraków Ostrzeżenie: (0%)
|
Mam pewne pytanie...
nie moge znalezc w manualach ani nigdzie indziej, jak zrobic cos takiego.. input: $string = "sKryPt testowy"; output: $tablica[0] = "s"; $tablica[1] = "K"; $tablica[2] = "r"; $tablica[3] = "y"; $tablica[4] = "P"; $tablica[5] = "t"; --------- funkcja explode dzieli wylacznie po znakach, jak wiec podzielic tekst NA ZNAKI? Pozdrawiam, marcin at leliwa dot com |
|
|
|
![]() |
Post
#2
|
|
|
Grupa: Zarząd Postów: 2 277 Pomógł: 6 Dołączył: 27.12.2002 Skąd: Wołów/Wrocław |
Jeszcze ciekawiej będzie w PHP5 - tam zostanie to zróżnicowane.
Cytat a) There is an ambiguity in today’s sharing of array offsets syntax for both strings
and arrays. In code such as $str[0] = ‘a’; where $str is an empty string (due to earlier php 4 and php 3 behavior) $str is treated as an array and therefore the above statement would result in $str[0] being converted to an array and having its offset 0 being set to the string “a”. However, some people would expect the result to be $str as the string value “a”. (IMG:http://forum.php.pl/style_emoticons/default/cool.gif) By introducing a specialized syntax for string offsets it will be possible to somewhat optimize the run-time processing, as we will know at compile-time that the user specifically means to use a string offset. c) Language wise it is much better if developers will be able to tell if the author meant to use array offsets or string offsets in a code snippet. Cytat Functionality
The currently suggested syntax is as follows: $str{2} = ‘a’; An example of the new functionality: $str1 = $str2 = “”; $str1{0} = ‘a’; $str2[0] = ‘a’; The result will be $str1 being the string “a” and $str2 being array(0 => “a”). |
|
|
|
sneewee explode? 14.05.2003, 12:02:44
Jabol jest taka sztuczka jak umieszcazanie kodu php w BB... 14.05.2003, 12:06:46
sneewee Cytatjest taka sztuczka jak umieszcazanie kodu php... 14.05.2003, 12:35:54
Jabol ale możesz zamiast next użyć for i używać $str[$i] 14.05.2003, 14:21:47
dragossani <?php
function strtoarray($string)
{
$array... 14.05.2003, 14:22:27
Jabol Cytat<?php
function strtoarray($string)
{
... 14.05.2003, 14:29:39
dragossani Pierwsze pytanie - racja. To przez przeoczenie.
Dr... 14.05.2003, 14:36:56
sneewee Cytatale możesz zamiast next użyć for i używać $st... 14.05.2003, 15:49:44 ![]() ![]() |
|
Aktualny czas: 26.12.2025 - 10:36 |