<?php echo do_shortcode(' '); ?> with variable

PHP
$childrens = do_shortcode( '[products ids="'. $string . '"]' );

Source

Also in PHP: