I want to take a string from a form and then split it into an array of characters using PHP, for example:
$a = 'professor'; $b[0] == 'p'; $b[1] == 'r'; $b[2] == 'o'; . . . . . $b[8] = 'r';
You do not need to do this. In PHP, you can access your characters directly from a string, as if it contained an array:
$var = "My String"; echo $var[1]; // Will print "y".
str_split($word);
This is faster than accessing $ word as an array.(And also better if you can iterate over it with foreach().) Documentation .
foreach()
, , :
$b = str_split($a)
$a [0], $a [1] ..
, , ASCII ().
Source: https://habr.com/ru/post/1706233/More articles:Returns a value from batch files (.bat file) to a text file - windowsHow can I get the text box value for a user control - asp.net-3.5Pygame: Sprite animation theory - need feedback - pythonДоступна ли виртуализация WrapPanel для WPF? Коммерческие или бесплатные - wpf"Неверный вызов или аргумент процедуры" при установке объекта "Принтер" - vb6How to convert function return value from array reference? - arraysWhere can I see a list of links and web links in an ASP.NET 2.0 web project - .netHow to add a dynamic text box in ASP.NET? - asp.netSQL Server 2005: replication, varbinary - sql-server-2005What is a failure condition in the CLR exception system? - .netAll Articles