![]() |
php function which work same as python index
dear all ..
any one can u please tell me that a function which work same as index of python and how to use it. thanks. |
Do you have an example of the python code? Also this is a PHP forum, not python.
|
There are multiple times where one can use "index" in Python. Please be more specific and clarify exactly what you need.
|
You will need to provide more information before we can be of use to you here. Are you referring to str.index() in python? If so strpos is probably what you are looking for. Otherwise we need to know more specifically what you want.
|
Quote:
here is the php code what i have written. function replaceWith($replaceWith) { $oldParent=$this->parent; $myIndex=$parent->contents->array_search($this); if ( $replaceWith->parent==$parent)) { $index=$this->parent->contents->index($parent,$replaceWith) if ($index && $index < $myIndex) { $myIndex=$myIndex-1; } $oldParent->insert($myIndex,$replaceWith) //insert function will be developed letter. } } |
I don't know any python, everything I've been getting was from documentation. So I ask again, what are you trying to do? There are multiple contexts in which index is used, before I can help you I need to know which context you are trying to use it in.
|
@tech your using index in several different meanings, which one (or many) are you trying to use. Index in python is a recurring keyword with different usage(s) based on its context.
|
| All times are GMT. The time now is 09:17 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0