answersLogoWhite

0

<?php

$str = "1234567";

$strArr = str_split($str); //split up $str by 1 character

$strlen = strlen($str) - 1; //get length of $str - 1 since the $strArr starts at 0

for($i=$strlen;$i>=0;$i--)

{

echo $strArr[$i];

}

?>

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

Which function is used to retrive the part of the string?

If a string features a separator (e.g. a dot or a comma), use PHP's explode() function to get an array with the two parts: $string = "hello,joe" $array = explode(",", $string); $array[0] will be "hello" $array[1] will be "joe" If not, you may use substr() to return a certain length of a string


How can I use the mini.split function to separate a string into an array of substrings in JavaScript?

To use the mini.split function in JavaScript to separate a string into an array of substrings, you need to call the split method on the string and provide the delimiter as an argument. This will split the string at each occurrence of the delimiter and return an array of substrings.


What do string and vector and array all inherit from that has the size method so you can take it as an argument?

string, vector and array do not have a common base class. Overload your function to accept either a string, a vector or an array.


Print reverse string in c sharp?

To print a reverse string in C#, you can use the Array.Reverse method or LINQ. Here's a simple example using Array.Reverse: string original = &quot;Hello, World!&quot;; char[] charArray = original.ToCharArray(); Array.Reverse(charArray); string reversed = new string(charArray); Console.WriteLine(reversed); This code converts the string to a character array, reverses the array, and then creates a new string from the reversed array before printing it.


Reverse of a string without using string handling function?

shashi


How do you reverse a string in PHP?

A predefined function can reverse a string as shown below:echo strrev('pizza'); // outputs: azzip


Write a function to reverse a string and to display it?

Yes.


How do you write string in reverse through the HTML tags?

Not possible through html. Use php strrev function. For eg:


What is the best way to write an array to a file in PHP?

The serialize() function is used to create a storable representation of a variable in PHP.To store an array to a file, you first use the serialize() function to change an array into a string. Save the string in a file using file I/O, so fwrite() or a similar function. When reading it use unserialize() to get the original array again.


Write a program to reverse the given string?

Use for loop declare string array str[] and string variable l= string length of string array j=l for i=0 to i=l/2 then temp=str[i] str[i]=str[j-1] str[j-1]=temp j=j-1 now print str array it will be reversed


How do you reverse a given string without using string functions?

1.take while loop in which u continue up to null in array of string. 2.once u get null pointer then take a new array of same length. 3.when u get null there ll save position no in variable i. 4.take while loop i to 0; 5.and j=0 for new array. 6.in above loop copy old array to new array in each cycle of loop. 7.j++; 8.u ll get reverse of string.


How do you reverse a string in PHP without using a function?

Without any function is impossible. So I'll assume you mean any coded function, in which case the predefined function below is your answer.$string = strrev($string);