Remember that containers are widgets that can contain other widgets. The simplest type of container is GtkBin - it can only hold one child widget. An example of this container is a regular button.

To add to or remove a widget from such a container:

<?php
  $container
->add($widget);
  
$container->remove($widget);
?>
To obtain all the widgets in a container, use one of the following approaches.

<?php
  $child_widgets 
$container->children();
  
$child_widgets $container->children;
?>
In either case $child_widgets will be an array of immediate children, but the second approach lets you access a specific child directly, e.g. $container->children[0].