[Solved] Assign line numbers to items in text

The question may be a case of “I have X and I need Y” where X is the item which needs attention. If the string really is as you presented it, then Imports System.Text Module Module1 Sub Main() Dim s = “{ “”0″”:{“”variable1″”:””ABC1″”,””variable2″”:””AA””,””variable3″”:””BB””}, “”5″”:{“”variable1″”:””ABC2″”,””variable2″”:””AA””,””variable3″”:””BB””}, “”3″”:{“”variable1″”:””BC3″”,””variable2″”:””AA””,””variable3″”:””BB””}, “”1″”:{“”variable1″”:””DC4″”,””variable2″”:””AA””,””variable3″”:””BB””}, “”4″”:{“”variable1″”:””DD5″”,””variable2″”:””AA””,””variable3″”:””BB””} }” Dim t = s.Split({vbCrLf}, StringSplitOptions.None) Dim u … Read more

[Solved] Loop through ID starting with speciific string [closed]

You can do it with document.querySelectorAll() and with for loop like follows: var nodes = document.querySelectorAll(‘[id^=name_]’); for(var i = 0; i < nodes.length; i++) { console.log(nodes[i].innerHTML); } <div id=”name_a”>aaa</div> <div id=”name_b”>bbb</div> Please note: with nodes.forEach you will get an exeption “Uncaught TypeError: nodes.forEach is not a function” because nodes is a NodeList and not an … Read more

[Solved] Only last element of array is displayed [closed]

You are overwriting the value of $tweetfeed in every itteration. $tweetfeed = array ( ‘status’ => $status ); Should be: $tweetfeed[] = array ( ‘status’ => $status ); By using [] you are pushing the value into the array, rather than overwriting it. You could actually simplify the whole thing to: $tweetfeed = array(); foreach($users … Read more

[Solved] Fatal error: Call to a member function url() on a non-object on line 8

Here’s your code corrected: <?php $subpages = $site->children()->visible(); foreach($subpages as $subpage) { $image_url = $subpage->image()->url(); $title = $subpage->title()->html(); echo ‘<div class=”col-md-4″>’; echo ‘<h2>’ . $title . ‘</h2>’; echo ‘<a href=”‘ . $subpage->url() . ‘” title=”‘ . $title . ‘”>’; echo ‘<img src=”‘ . $image_url . ‘” alt=”‘ . $title . ‘” class=”img-responsive img-thumbnail”>’; echo ‘</a>’; … Read more

[Solved] php foreach array id value

You didn’t provided proper source code of your array. So I couldn’t understand properly I think, still I’m trying to answer. If your ID number and text both are stored in $list array values, like this – $list = array( ‘id1:text 1’, ‘id2:text 2’, … ); then you could do something like this $idArr= array(); … Read more

[Solved] ForEach loop counter [duplicate]

Rather than having two separate counters, I recommend starting by taking the length of the array and using a counter to print a comma while the counter is less than the number of total items in the array. That way, when you finish you’ll have one less comma than array item, and you won’t have … Read more

[Solved] Foreach go up by 1 php

Start the loop at the $ac0->result and then all the properties will be found in the $obj or whatever you like to call it in the foreach loop foreach ($ac0->result as $idx => $obj) { echo “From Array $idx <br>”; echo $obj->name . “<br>”; echo $obj->status . “<br>”; // etc } 2 solved Foreach go … Read more