Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php variable outside foreach

$categorySize = array();

<?php  $categories = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect('*'); 
         foreach ($categories as $category): 
         $categorySize = $category->getSize_chart(); 
         print_r ($categorySize); 
         endforeach;
    ?>

print_r($categorySize) //Now you can get it outside the loop 
Comment

php variable outside foreach

$pages = get_pages();
$pagee = array();
foreach ($pages as $page) {
  $pagee[] = $page->post_title;
}
echo implode(",",$pagee);
Comment

PREVIOUS NEXT
Code Example
Php :: join 2 tables laravel 
Php :: php carbon convert string to date 
Php :: Laravel loop iternation pagination issue 
Php :: laravel drop multiple columns 
Php :: woocommerce if it is shop page remove breadcrumbs 
Php :: redirect to site php 
Php :: errno: 150 foreign key constraint is incorrectly formed laravel 8 
Php :: open php ini from terminal 
Php :: php base64 encoded image to png 
Php :: checking php version 
Php :: php get all values from associative array 
Php :: validate time in laravel 
Php :: laravel active nav 
Php :: how to remove public from url in laravel 
Php :: laravel public access inserver using htaccess 
Php :: laravel collection each 
Php :: php home url 
Php :: run raw sql with doctrine manager 
Php :: add column migration laravel 
Php :: implode php 
Php :: Get date without time in laravel 
Php :: Allowed memory size of 1610612736 bytes exhausted 
Php :: Notice: Undefined property: enable_for_virtual 
Php :: php get all url parameters 
Php :: php artisan up 
Php :: array_search in php 
Php :: join cakphp 
Php :: php while loop of alphabet 
Php :: current URL without url site laravel 
Php :: php capital string 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =